Support the PCRE Regex PARTIAL_{HARD,SOFT} opts. #33646
Open
+3
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make
exec
aware of thePARTIAL_HARD
andPARTIAL_SOFT
flags set on aRegex
object.This allows
match()
to return partial matches if they are requested by the user in the Regex options. Currently we are ignoring these options, since partial matches are returned as a-2
status code, and we are not currently checking for that.Partial Regex matches are often used for interactive validation of UI fields (e.g. in a web page):
I didn't include a convenience function for constructing a partial regex, which maybe we should also include in this PR?
Right now we're constructing them in our code like this:
But it might make sense to add a flag to the
r""
macro, in the same style as them
/i
flags? I couldn't find any equivalent such flags online -- where is the inspiration for those one-letter flags taken from?Or this could be done in follow-up PRs.