I'm trying to find a regex search term that can sort through cells (populated by a multiple select picklist) and retrieve entries which match 2 conditions: either 'Other' is present or, where there is more than one option selected, where 'Other' is present but not if preceded by ' - '.
An example of records would be
- Other
- Other; Hat
- Hat; Other
- Hat - Other; Other
- Other; Hat - Other; Scarf - Other
- Scarf - Other; Hat - Other
I'd hope to get 5 matches from this, since the last does not contain the 'Other' value as it's own phrase, but just in connection to the wider values which are themselves qualified by the presence of '- Other'.
Thank you!
CodePudding user response:
Use a negative look behind for "- " before Other:
(?<!- )Other
See live demo.
CodePudding user response:
Seems the cell picklist delimiter is the semi-colon.
If so, it can be done using that or the beginning of line operator.
(?:^|;)[ ]*Other
