find word that each character separated by space












1















I need a regex to select a word that each char on that word separated by whitespace. Look at the following string



Mengkapan,Sungai Apit,S I A K,Riau,


I want to select S I A K. I am stuck, I was trying to use the following regex



s+w{1}s+


but it's not working.










share|improve this question




















  • 1





    b[A-Za-z](?:s+[A-Za-z])+b

    – Dmitry Bychenko
    Nov 19 '18 at 7:22











  • awesome..thank you @DmitryBychenko

    – Dariel Pratama
    Nov 19 '18 at 7:24
















1















I need a regex to select a word that each char on that word separated by whitespace. Look at the following string



Mengkapan,Sungai Apit,S I A K,Riau,


I want to select S I A K. I am stuck, I was trying to use the following regex



s+w{1}s+


but it's not working.










share|improve this question




















  • 1





    b[A-Za-z](?:s+[A-Za-z])+b

    – Dmitry Bychenko
    Nov 19 '18 at 7:22











  • awesome..thank you @DmitryBychenko

    – Dariel Pratama
    Nov 19 '18 at 7:24














1












1








1








I need a regex to select a word that each char on that word separated by whitespace. Look at the following string



Mengkapan,Sungai Apit,S I A K,Riau,


I want to select S I A K. I am stuck, I was trying to use the following regex



s+w{1}s+


but it's not working.










share|improve this question
















I need a regex to select a word that each char on that word separated by whitespace. Look at the following string



Mengkapan,Sungai Apit,S I A K,Riau,


I want to select S I A K. I am stuck, I was trying to use the following regex



s+w{1}s+


but it's not working.







regex sublimetext3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 8:00









Dmitry Bychenko

106k992132




106k992132










asked Nov 19 '18 at 7:19









Dariel PratamaDariel Pratama

6981725




6981725








  • 1





    b[A-Za-z](?:s+[A-Za-z])+b

    – Dmitry Bychenko
    Nov 19 '18 at 7:22











  • awesome..thank you @DmitryBychenko

    – Dariel Pratama
    Nov 19 '18 at 7:24














  • 1





    b[A-Za-z](?:s+[A-Za-z])+b

    – Dmitry Bychenko
    Nov 19 '18 at 7:22











  • awesome..thank you @DmitryBychenko

    – Dariel Pratama
    Nov 19 '18 at 7:24








1




1





b[A-Za-z](?:s+[A-Za-z])+b

– Dmitry Bychenko
Nov 19 '18 at 7:22





b[A-Za-z](?:s+[A-Za-z])+b

– Dmitry Bychenko
Nov 19 '18 at 7:22













awesome..thank you @DmitryBychenko

– Dariel Pratama
Nov 19 '18 at 7:24





awesome..thank you @DmitryBychenko

– Dariel Pratama
Nov 19 '18 at 7:24












3 Answers
3






active

oldest

votes


















2














I suggest



b[A-Za-z](?:s+[A-Za-z])+b


pattern, where



b           - word boundary
[A-Za-z] - letter (exactly one)
(?: - one or more groups of
s+ - white space (at least one)
[A-Za-z] - letter (exactly one)
)+
b - word boundary





share|improve this answer



















  • 1





    all anwsers from people on SO are working perfectly, but Dmitry answer's deserved to be accepted answer because he's the first to comment. thank you very much.

    – Dariel Pratama
    Nov 19 '18 at 7:39



















2














For your given information, you could use



(?:[A-Za-z] ){2,}[A-Za-z]


See a demo on regex101.com.






share|improve this answer



















  • 1





    Counter example? "As I Say" will return match "s I S"

    – Dmitry Bychenko
    Nov 19 '18 at 7:42





















2














You could match a word boundary b, a word character w and repeat at least 2 times a space and a word character followed by a word boundary:



bw(?: w){2,}b



Regex demo






share|improve this answer


























  • Counter example? "As I Say" will return match "s I S"

    – Dmitry Bychenko
    Nov 19 '18 at 7:43








  • 1





    @DmitryBychenko Sharp! You are right, I have added word boundaries.

    – The fourth bird
    Nov 19 '18 at 7:46











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53369963%2ffind-word-that-each-character-separated-by-space%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














I suggest



b[A-Za-z](?:s+[A-Za-z])+b


pattern, where



b           - word boundary
[A-Za-z] - letter (exactly one)
(?: - one or more groups of
s+ - white space (at least one)
[A-Za-z] - letter (exactly one)
)+
b - word boundary





share|improve this answer



















  • 1





    all anwsers from people on SO are working perfectly, but Dmitry answer's deserved to be accepted answer because he's the first to comment. thank you very much.

    – Dariel Pratama
    Nov 19 '18 at 7:39
















2














I suggest



b[A-Za-z](?:s+[A-Za-z])+b


pattern, where



b           - word boundary
[A-Za-z] - letter (exactly one)
(?: - one or more groups of
s+ - white space (at least one)
[A-Za-z] - letter (exactly one)
)+
b - word boundary





share|improve this answer



















  • 1





    all anwsers from people on SO are working perfectly, but Dmitry answer's deserved to be accepted answer because he's the first to comment. thank you very much.

    – Dariel Pratama
    Nov 19 '18 at 7:39














2












2








2







I suggest



b[A-Za-z](?:s+[A-Za-z])+b


pattern, where



b           - word boundary
[A-Za-z] - letter (exactly one)
(?: - one or more groups of
s+ - white space (at least one)
[A-Za-z] - letter (exactly one)
)+
b - word boundary





share|improve this answer













I suggest



b[A-Za-z](?:s+[A-Za-z])+b


pattern, where



b           - word boundary
[A-Za-z] - letter (exactly one)
(?: - one or more groups of
s+ - white space (at least one)
[A-Za-z] - letter (exactly one)
)+
b - word boundary






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 19 '18 at 7:25









Dmitry BychenkoDmitry Bychenko

106k992132




106k992132








  • 1





    all anwsers from people on SO are working perfectly, but Dmitry answer's deserved to be accepted answer because he's the first to comment. thank you very much.

    – Dariel Pratama
    Nov 19 '18 at 7:39














  • 1





    all anwsers from people on SO are working perfectly, but Dmitry answer's deserved to be accepted answer because he's the first to comment. thank you very much.

    – Dariel Pratama
    Nov 19 '18 at 7:39








1




1





all anwsers from people on SO are working perfectly, but Dmitry answer's deserved to be accepted answer because he's the first to comment. thank you very much.

– Dariel Pratama
Nov 19 '18 at 7:39





all anwsers from people on SO are working perfectly, but Dmitry answer's deserved to be accepted answer because he's the first to comment. thank you very much.

– Dariel Pratama
Nov 19 '18 at 7:39













2














For your given information, you could use



(?:[A-Za-z] ){2,}[A-Za-z]


See a demo on regex101.com.






share|improve this answer



















  • 1





    Counter example? "As I Say" will return match "s I S"

    – Dmitry Bychenko
    Nov 19 '18 at 7:42


















2














For your given information, you could use



(?:[A-Za-z] ){2,}[A-Za-z]


See a demo on regex101.com.






share|improve this answer



















  • 1





    Counter example? "As I Say" will return match "s I S"

    – Dmitry Bychenko
    Nov 19 '18 at 7:42
















2












2








2







For your given information, you could use



(?:[A-Za-z] ){2,}[A-Za-z]


See a demo on regex101.com.






share|improve this answer













For your given information, you could use



(?:[A-Za-z] ){2,}[A-Za-z]


See a demo on regex101.com.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 19 '18 at 7:23









JanJan

24.3k52348




24.3k52348








  • 1





    Counter example? "As I Say" will return match "s I S"

    – Dmitry Bychenko
    Nov 19 '18 at 7:42
















  • 1





    Counter example? "As I Say" will return match "s I S"

    – Dmitry Bychenko
    Nov 19 '18 at 7:42










1




1





Counter example? "As I Say" will return match "s I S"

– Dmitry Bychenko
Nov 19 '18 at 7:42







Counter example? "As I Say" will return match "s I S"

– Dmitry Bychenko
Nov 19 '18 at 7:42













2














You could match a word boundary b, a word character w and repeat at least 2 times a space and a word character followed by a word boundary:



bw(?: w){2,}b



Regex demo






share|improve this answer


























  • Counter example? "As I Say" will return match "s I S"

    – Dmitry Bychenko
    Nov 19 '18 at 7:43








  • 1





    @DmitryBychenko Sharp! You are right, I have added word boundaries.

    – The fourth bird
    Nov 19 '18 at 7:46
















2














You could match a word boundary b, a word character w and repeat at least 2 times a space and a word character followed by a word boundary:



bw(?: w){2,}b



Regex demo






share|improve this answer


























  • Counter example? "As I Say" will return match "s I S"

    – Dmitry Bychenko
    Nov 19 '18 at 7:43








  • 1





    @DmitryBychenko Sharp! You are right, I have added word boundaries.

    – The fourth bird
    Nov 19 '18 at 7:46














2












2








2







You could match a word boundary b, a word character w and repeat at least 2 times a space and a word character followed by a word boundary:



bw(?: w){2,}b



Regex demo






share|improve this answer















You could match a word boundary b, a word character w and repeat at least 2 times a space and a word character followed by a word boundary:



bw(?: w){2,}b



Regex demo







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 19 '18 at 7:53

























answered Nov 19 '18 at 7:35









The fourth birdThe fourth bird

21k71326




21k71326













  • Counter example? "As I Say" will return match "s I S"

    – Dmitry Bychenko
    Nov 19 '18 at 7:43








  • 1





    @DmitryBychenko Sharp! You are right, I have added word boundaries.

    – The fourth bird
    Nov 19 '18 at 7:46



















  • Counter example? "As I Say" will return match "s I S"

    – Dmitry Bychenko
    Nov 19 '18 at 7:43








  • 1





    @DmitryBychenko Sharp! You are right, I have added word boundaries.

    – The fourth bird
    Nov 19 '18 at 7:46

















Counter example? "As I Say" will return match "s I S"

– Dmitry Bychenko
Nov 19 '18 at 7:43







Counter example? "As I Say" will return match "s I S"

– Dmitry Bychenko
Nov 19 '18 at 7:43






1




1





@DmitryBychenko Sharp! You are right, I have added word boundaries.

– The fourth bird
Nov 19 '18 at 7:46





@DmitryBychenko Sharp! You are right, I have added word boundaries.

– The fourth bird
Nov 19 '18 at 7:46


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53369963%2ffind-word-that-each-character-separated-by-space%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to send String Array data to Server using php in android

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Is anime1.com a legal site for watching anime?