L
Laura
I am using regular expressions to preprocess text and add text around
certain terms. Because the text can contain html, I use look-ahead
logic to exclude any text that comes between a "<" and a ">". My
expression looks like this:
(\\b)(term)(\\b)(?![^<]*>)
Where "term" is the term I'm looking for in the text. It's working
just fine, but now a new requirement has arisen that means we want to
look for terms separated by underscores as well as word boundary
characters.
How can I modify the above pattern to find my terms when they're
separated by either word boundary characters or an underscore?
Any help gratefully accepted!
certain terms. Because the text can contain html, I use look-ahead
logic to exclude any text that comes between a "<" and a ">". My
expression looks like this:
(\\b)(term)(\\b)(?![^<]*>)
Where "term" is the term I'm looking for in the text. It's working
just fine, but now a new requirement has arisen that means we want to
look for terms separated by underscores as well as word boundary
characters.
How can I modify the above pattern to find my terms when they're
separated by either word boundary characters or an underscore?
Any help gratefully accepted!