Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

regular expression to match two words with a space

Tags:

regex

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.)

like image 464
Hello World Avatar asked May 29 '13 13:05

Hello World


1 Answers

\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:

enter image description here

like image 106
tsm Avatar answered Nov 03 '22 01:11

tsm