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\/])+
if want version that's javascript friendly:
((?:(?=(\([\w\/]+\)|[\w\/]))\2)+)
just use capture group #1 here.
Comments
Post a Comment