Optional match at start of pattern

How can I do an optional match at the start of a pattern. The works in the middle of the pattern, but if I want to match “track, test and trace” and “test and trace”, I can’t make it work with this example.

<pattern>
<token min="0">track</token>
<token min="0">,</token>
<marker><token regexp="yes" >test</token>
<token>and</token>
<token>trace</token></marker>
</pattern>

min="0" at the start or end of the pattern as in your case doesn’t seem to be useful, it’s the same as just leaving out that token.

1 Like