Reputation: 1437
I am looking for the regular expression needed to match the follow pattern
hello, hello world, helloworld
I would only want the bold set to be picked up (the space included.)
Upvotes: 10
Views: 26819
Reputation: 21
^hello\sworld$
Upvotes: 2
Reputation: 2551
\b[a-zA-Z]+\s[a-zA-Z]+\b
as \w
could match numbers also.
\b
is a word boundary
Upvotes: 0
Reputation: 3658
\w+\s\w+
At least one word character, then a space (or tab, or what have you), then at least another word character.
Here's what it looks like:
Upvotes: 13