Miguel Sanchez Miguel Sanchez - 1 year ago 149
Vb.net Question

Regex exclude brackets

I have the following regex:


Test string:

this is a test [est+where] esterius

it should only highlight the first "est". Sadly the bracket [ and the + symbol is also matched. But I want only my word "est" to be matched if the character before and after is non-alphabetical and not numeric

Answer Source

You should make use of lookaheads and lookbehinds:


Which basically match something without including it in the resulting match.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download