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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -