Avatar of campinam
campinam
 asked on

Convert regex to regexp

In .Net the regex (?<=>[^<]*?)\bă works as expected (find words that start with ă and are not located within a tag).

But in JavaScript Chrome \b won't work with Unicode texts.

What would be the correct equivalent in JavaScript for the above .Net expression?

(I am referring to the latest versions of regex/regexp)
Regular Expressions.NET ProgrammingChromeJavaScriptScripting Languages

Avatar of undefined
Last Comment
wilcoxon

8/22/2022 - Mon
aikimark

I'm surprised it works in .Net
wilcoxon

I think this should work:
 (?<=>[^<]*?\W)ă

Open in new window


\W is a non-word (non-letter, non-number) character.
campinam

ASKER
\W is a non-word, but an ASCII construct n JavaScript. It matches non-ASCII letters as well, even with the u flag. So it won't do.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
wilcoxon

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.