Settings

Theme

Ask HN: Python library for regex with “extent-of-match”

2 points by georgeam 4 years ago · 0 comments · 1 min read


From CS Theory, all regular expressions can be converted to deterministic finite automata. I would like a python library that tells me the precise point at which a string "loses hope" of matching a regular expression. Eg.

Given a regular expression like aba*

And a string like abbab

I want an output that says the match failed at an index of 2.

meaning that the first ab match (or more technically, are the prefix of a match), but the remaining bab "kill" the possibility of a match.

Anyone know of a python library that does this?

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection