Skip to content
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

Second line is matching with multiline option when trying to match start of entire input #1879

Closed
learnbyexample opened this issue May 29, 2021 · 2 comments
Labels
duplicate An issue that is duplicative of another.

Comments

@learnbyexample
Copy link

What version of ripgrep are you using?

ripgrep 12.1.1 (rev 7cb211378a)

How did you install ripgrep?

Using ripgrep_12.1.1_amd64.deb

What operating system are you using ripgrep on?

Ubuntu 20.04 LTS

Describe your bug.

Was trying to create an example to show difference between \A and ^ anchors when multiline option is enabled. For certain input, \A is matching second line content.

What is the actual behavior?

Example with \A string anchor. The last command gives no output as expected.

$ printf '1\nbaz\nabc\n' | rg -U '\Ab'
baz
$ printf '12\nbaz\nabc\n' | rg -U '\Ab'
baz
$ printf '123\nbaz\nabc\n' | rg -U '\Ab'
$ 

Same thing seen with ^ anchor and m flag disabled:

$ printf '1\nbaz\nabc\n' | rg -U '(?-m)^b'
baz
$ printf '12\nbaz\nabc\n' | rg -U '(?-m)^b'
baz
$ printf '123\nbaz\nabc\n' | rg -U '(?-m)^b'
$ 

What is the expected behavior?

Second line shouldn't match for above cases.

@BurntSushi BurntSushi added the duplicate An issue that is duplicative of another. label May 29, 2021
@BurntSushi
Copy link
Owner

I beat you to it: #1878 :-)

Fix is on master.

@learnbyexample
Copy link
Author

Wow, you saw the comment, filed an issue and fixed it while I was still trying to generate more test cases (I was about to edit my issue to add those when I saw it was closed already!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate An issue that is duplicative of another.
Projects
None yet
Development

No branches or pull requests

2 participants