Closed
Description
If I utilise a regex with the global flag enabled, like this:
<ParsedText parse={[{pattern: /a/g, renderText: () => 'z'}]}> aaaa </ParsedText>
I would expect the output to be: zzzz
Whereas, I would expect this:
<ParsedText parse={[{pattern: /a/, renderText: () => 'z'}]}> aaaa </ParsedText>
to output: zaaa
as the global flag is removed and is only matching the first instance.
At the moment the second example will output zzzz
as the parser will continue matching the pattern against any remaining text.
While I understand there may be people depending on this behaviour is there any workaround to ensure only the first match is rendered?
Metadata
Metadata
Assignees
Labels
No labels