Skip to content

Comments

Matcher: no useless backtracking in group replace#190

Open
kitbellew wants to merge 1 commit intogoogle:masterfrom
kitbellew:187_3
Open

Matcher: no useless backtracking in group replace#190
kitbellew wants to merge 1 commit intogoogle:masterfrom
kitbellew:187_3

Conversation

@kitbellew
Copy link

When encountering ${, we do not move the read index forward to the } and continue iterating on it again.

The reason it "worked" is two-fold:

  • a group name contains alphanumeric or underscore, which won't trigger special handling in the loop (only \\ and $ would)
  • we had already moved last index past the closing }

Helps with #187.

When encountering `${`, we do not move the read index forward to the `}`
and continue iterating on it again.

The reason it "worked" is two-fold:
- a group name contains alphanumeric or underscore, which won't trigger
  special handling in the loop (only `\\` and `$` would)
- we had already moved `last` index past the closing `}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant