Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
The other option is No idea about it's dos risks or whether the c code is harder to compile for all platforms than pure rust? |
|
@samuelcolvin ReDoS stems from backtracking features, so just one more implementation won’t work. IIRC google's |
samuelcolvin
left a comment
There was a problem hiding this comment.
Partial review since I have to go, but this looks great overall.
I would suggest we use fancy-regex with backtrack_limit() set to something reasonable, with that the dos risk seems acceptable.
|
So iirc |
A few options:
|
|
@samuelcolvin apologies for disturbing, but I wish to confirm the codecov. Certain sections of code prove difficult to construct during testing, so I am uncertain whether they require coverage. |
This PR introduces a subset of Python’s
remodule. It might close #132 as a partial implementation.Full API list
re.Matchbool,type,__eq__,__repr__.group(),.groups().span(),.end().stringre.Pattern.pattern.flagsre.IGNORECASE,re.MULTILINE,re.DOTALLre.compile(),re.match(),re.fullmatch(),re.findall(),re.sub()re.PatternError(notes)Unresolved questions
re.PatternErrorbehaviorre.PatternErrorbehaviorThe
montyimplementation introducesre.PatternErroras a plain error with only a test.The
monty-pythonbinding falls back toRuntimeErrorbecause retrievingre.PatternErroris awkward unless we do something likepy.import("re")?.get_attr("PatternError")?.call1((msg,)).Regex behavior
By default, this PR uses the
regexcrate, which does not support backreferences, lookahead, etc.Switching to
fancy_regexcould more closely match CPython’s default behavior, but might introduce ReDoS risk.