find word that each character separated by space
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
add a comment |
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
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
add a comment |
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
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
regex sublimetext3
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
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
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
add a comment |
For your given information, you could use
(?:[A-Za-z] ){2,}[A-Za-z]
See a demo on regex101.com.
1
Counter example?"As I Say"will return match"s I S"
– Dmitry Bychenko
Nov 19 '18 at 7:42
add a comment |
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
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
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
add a comment |
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
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
add a comment |
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
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
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
add a comment |
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
add a comment |
For your given information, you could use
(?:[A-Za-z] ){2,}[A-Za-z]
See a demo on regex101.com.
1
Counter example?"As I Say"will return match"s I S"
– Dmitry Bychenko
Nov 19 '18 at 7:42
add a comment |
For your given information, you could use
(?:[A-Za-z] ){2,}[A-Za-z]
See a demo on regex101.com.
1
Counter example?"As I Say"will return match"s I S"
– Dmitry Bychenko
Nov 19 '18 at 7:42
add a comment |
For your given information, you could use
(?:[A-Za-z] ){2,}[A-Za-z]
See a demo on regex101.com.
For your given information, you could use
(?:[A-Za-z] ){2,}[A-Za-z]
See a demo on regex101.com.
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
add a comment |
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
add a comment |
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
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
add a comment |
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
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
add a comment |
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
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
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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