How to match a particular word except for occurrences in square brackets


#1

Hello,

I’m trying to use regex in the search field to find all strings containing the word “organization” but not when it occurs in between square brackets:

Example strings:

The organization “[organization name]” must contain at least one user per organization.
The ID [id] for [organization] must contain digits only

I try to use: (?:^|\s)(organization)(?!])

but it fails because of the negative lookahead (i guess)

It seems to work in other flavors
https://regex101.com/r/tG7kC0/1


#2

Lookaheads and lookbehinds are not supported in POSIX regex, which is the one supported by Xbench.

Perhaps one possible workaround for what appears to be your use case could be to export the segments with Xbench as tab-delimited, do a global change of square brackets ([]) with angle brackets (<>) and load the tab-delimited file into Xbench. Then you can search or QA with the *Ignore tags setting.


How to match multiple instances in the source