Skip to content

Conversation

@stephentoub
Copy link
Member

For example, today we will convert a*b into the equivalent of (?>a*)b, but we won't modify a*?b... with this PR, that will also become the equivalent of (?>a*)b.

@stephentoub stephentoub added this to the 7.0.0 milestone May 6, 2022
@ghost
Copy link

ghost commented May 6, 2022

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

Issue Details

For example, today we will convert a*b into the equivalent of (?>a*)b, but we won't modify a*?b... with this PR, that will also become the equivalent of (?>a*)b.

Author: stephentoub
Assignees: -
Labels:

area-System.Text.RegularExpressions, tenet-performance

Milestone: 7.0.0

@ghost ghost assigned stephentoub May 6, 2022
@joperezr
Copy link
Member

joperezr commented May 6, 2022

with this PR, that will also become the equivalent of (?>a*)b.

I suppose you meant the equivalent of (?>a*?)b?

@stephentoub
Copy link
Member Author

stephentoub commented May 6, 2022

with this PR, that will also become the equivalent of (?>a*)b.

I suppose you meant the equivalent of (?>a*?)b?

No :-) An atomic lazy loop matches only the minimum required. But in the situations relevant to this PR, if there's no overlap between what's guaranteed to come after the loop and the loop itself, the loop has to match as much as possible... if it doesn't and it could have matched more, the pattern can't match because what's next in the pattern won't match. Thus there's no difference between greedy and lazy in terms of the resulting match... a lazy loop would backtrack until it matched the full amount.

@joperezr
Copy link
Member

joperezr commented May 9, 2022

Yes sorry, that makes sense, I had a brain freeze for a second and missed the point of the PR 😆

@stephentoub stephentoub merged commit 1368c74 into dotnet:main May 10, 2022
@stephentoub stephentoub deleted the lazycharimprovements branch May 10, 2022 03:10
@ghost ghost locked as resolved and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants