c# RegEx, how to filter the resultset of regex [closed]

You actually need an alternation operator with capturing group.

banaana|(apple)

The idea is, first banaana would greedily match all the banaana strings. | OR (apple) capture apple strings only from the remaining characters. So this won’t overlap with banaana strings.

Example

Browse More Popular Posts

Leave a Comment