Skip to content

VM replaceAll with "^" RegExp doesn't work #2980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nex3 opened this issue May 9, 2012 · 8 comments
Closed

VM replaceAll with "^" RegExp doesn't work #2980

nex3 opened this issue May 9, 2012 · 8 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@nex3
Copy link
Member

nex3 commented May 9, 2012

Consider the following code:

   "foo\nbar\nbaz".replaceAll(const RegExp("^", multiLine: true), " ")

This is expected to return " foo\n bar\n baz". It does so in Frog, but in the VM it returns " foo\n bar\n baz". I'm not sure where the extra whitespace is coming from.

@iposva-google
Copy link
Contributor

Carl, can you please verify why we have a difference here?


Set owner to @lexprfuncall.
Added Accepted label.

@lexprfuncall
Copy link

The list of matches seems to repeat subsequent matches when the multiline flag is set. If I print out each start, end pair returned by allMatches here is what I see

match=[0, 0]
match=[4, 4]
match=[4, 4]
match=[4, 4]
match=[4, 4]
match=[8, 8]
match=[8, 8]
match=[8, 8]
match=[8, 8]

This suggests something is going wrong in the native glue or below it, somewhere.

@iposva-google
Copy link
Contributor

Removed the owner.
Added Triaged label.

@iposva-google
Copy link
Contributor

Added this to the Later milestone.
Removed Priority-Medium label.
Added Priority-Low label.

@iposva-google
Copy link
Contributor

Removed this from the Later milestone.
Removed Priority-Low label.
Added Priority-Unassigned label.

@lrhn
Copy link
Member

lrhn commented Jun 6, 2013

The number of extra matches depends on the number of characters before. A quick guess is that the start-position is being incremented by 1, instead of set to after the previous match.
Since this is a zero-width match, the problem is probably in the code handling that special case - it sets the next position to the start-position + 1, not the end-position + 1.

@lrhn
Copy link
Member

lrhn commented Jun 6, 2013

I was already touching that code anyway.


Set owner to @lrhn.

@lrhn
Copy link
Member

lrhn commented Jun 6, 2013

Added Fixed label.

@nex3 nex3 added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Jun 6, 2013
@nex3 nex3 assigned lrhn Jun 6, 2013
dart-bot pushed a commit that referenced this issue May 21, 2021
New commits include:
```
git log --format="%C(auto) %h %s" 00c00e8adf9706bebe8f94483b7663c5f36f59d2..def32ceb1d660552eaec24839d377199aea5a569
 def32ceb Revert "Revert "Use the frontend server to compile pub executables (#2968)" (#3006)" (#3008)
 0dc7e50c Make `.gitignore` and `.pubignore` case-insensitive on Windows / MacOS (#3009)
 e89d4ab8 Generate GNU-style long file names in tar archives (#3005)
 d2ad13d0 Revert "Use the frontend server to compile pub executables (#2968)" (#3006)
 492b15ba New binstubs for global activate using `dart pub` (#3002)
 e02f23bb fix grammer in .gitignore error message (#2995)
 e01e3a41 Use the frontend server to compile pub executables (#2968)
 647989c6 Use RetryClient from package:http/retry.dart (#2980)
```

Change-Id: I9a0b5fb2b5616a5a0eaa16f3a90205bb1bb1fc8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200878
Auto-Submit: Jonas Jensen <[email protected]>
Commit-Queue: Alexander Thomas <[email protected]>
Reviewed-by: Alexander Thomas <[email protected]>
dart-bot pushed a commit that referenced this issue May 21, 2021
This reverts commit 5c9e37f.

Reason for revert: flutter builds on golem somehow broke.

Original change's description:
> Bump pub.
>
> New commits include:
> ```
> git log --format="%C(auto) %h %s" 00c00e8adf9706bebe8f94483b7663c5f36f59d2..def32ceb1d660552eaec24839d377199aea5a569
>  def32ceb Revert "Revert "Use the frontend server to compile pub executables (#2968)" (#3006)" (#3008)
>  0dc7e50c Make `.gitignore` and `.pubignore` case-insensitive on Windows / MacOS (#3009)
>  e89d4ab8 Generate GNU-style long file names in tar archives (#3005)
>  d2ad13d0 Revert "Use the frontend server to compile pub executables (#2968)" (#3006)
>  492b15ba New binstubs for global activate using `dart pub` (#3002)
>  e02f23bb fix grammer in .gitignore error message (#2995)
>  e01e3a41 Use the frontend server to compile pub executables (#2968)
>  647989c6 Use RetryClient from package:http/retry.dart (#2980)
> ```
>
> Change-Id: I9a0b5fb2b5616a5a0eaa16f3a90205bb1bb1fc8f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200878
> Auto-Submit: Jonas Jensen <[email protected]>
> Commit-Queue: Alexander Thomas <[email protected]>
> Reviewed-by: Alexander Thomas <[email protected]>

[email protected],[email protected]

Change-Id: I635e1c2db8ae965881359d4969cbd506348b0ed0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201000
Reviewed-by: Jonas Jensen <[email protected]>
Commit-Queue: Jonas Jensen <[email protected]>
dart-bot pushed a commit that referenced this issue May 25, 2021
This is a reland of 5c9e37f
Following update of `DEPS` in `flutter/engine`:
  flutter/engine#26395

New commits include:
```
git log --format="%C(auto) %h %s" 00c00e8adf9706bebe8f94483b7663c5f36f59d2..def32ceb1d660552eaec24839d377199aea5a569
 def32ceb Revert "Revert "Use the frontend server to compile pub executables (#2968)" (#3006)" (#3008)
 0dc7e50c Make `.gitignore` and `.pubignore` case-insensitive on Windows / MacOS (#3009)
 e89d4ab8 Generate GNU-style long file names in tar archives (#3005)
 d2ad13d0 Revert "Use the frontend server to compile pub executables (#2968)" (#3006)
 492b15ba New binstubs for global activate using `dart pub` (#3002)
 e02f23bb fix grammer in .gitignore error message (#2995)
 e01e3a41 Use the frontend server to compile pub executables (#2968)
 647989c6 Use RetryClient from package:http/retry.dart (#2980)
```

Original change's description:
> Change-Id: I9a0b5fb2b5616a5a0eaa16f3a90205bb1bb1fc8f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200878
> Auto-Submit: Jonas Jensen <[email protected]>
> Commit-Queue: Alexander Thomas <[email protected]>
> Reviewed-by: Alexander Thomas <[email protected]>

Change-Id: I1a0570318c63ec97fd141d79b405f55105111077
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201260
Commit-Queue: Jonas Jensen <[email protected]>
Reviewed-by: Alexander Thomas <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

4 participants