Skip to content

Add support for regex with global flag. #60

Description

@bram-ontoforce

Regular expressions with a global flag are not working right. The code uses regex.test() and regex.exec(), both increasing an internal lastIndex counter.

For example:

<Highlight search=/brown|jumps/g">The quick brown fox jumps over the lazy dog</Highlight>

will only highlight 'jumps' because the first conditional search.test(remainingCleaned) will move the lastIndex counter right after the 'brown' keyword. search.exec(subject) will then only find 'jumps'.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions