-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
I have a long string and need to check if a regex matches at the beginning of it (I am writing a lexer). Unfortunately, regex-tdfa does not appear to stop searching once it is clear that there is no match. For example, the following code snippet takes several seconds to evaluate on my machine:
Text.Regex.TDFA> replicate 100000000 'f' =~~ "\\`g" :: Maybe String
Nothing
However, the code snippet should evaluate instantly, because as soon as the first character is inspected it is clear that the regex does not match at the beginning of the string. Given this behavior, it seems impossible to use regex-tdfa to performantly match a regex at the beginning of a string. Is there a special-purpose function for this that I have missed?
Metadata
Metadata
Assignees
Labels
No labels