regex - javascript regexp for word boundary detection with parenthesis -


i have string "i robot, have been named 456/m(4). forget name (it not mean anything)"

now extract words string use regular expression:

/\b[\w\s]+\b/g 

it returns me words in string except there word "456/(4" instead of "456/(4)". understand due fact word boundary, there way not legal word boundary since there no "legal" starting parenthesis?

i made better now. want.

\b(?>\([\w\/]+\)|[\w\/])+ 

regex101

if want version that's javascript friendly:

((?:(?=(\([\w\/]+\)|[\w\/]))\2)+) 

just use capture group #1 here.

regex101


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -