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

Results not matching grep #1973

Closed
Vagelis-Prokopiou opened this issue Aug 17, 2021 · 2 comments
Closed

Results not matching grep #1973

Vagelis-Prokopiou opened this issue Aug 17, 2021 · 2 comments
Labels
duplicate An issue that is duplicative of another.

Comments

@Vagelis-Prokopiou
Copy link

What version of ripgrep are you using?

ripgrep 13.0.0 (rev c9e3ffc419)

How did you install ripgrep?

cargo install ripgrep

What operating system are you using ripgrep on?

Git Bash (version 4.4.23(1)-release (x86_64-pc-msys)) in Windows 10.

Describe your bug.

Results not matching grep when the search pattern contains slashes.

What are the steps to reproduce the behavior?

rg '/form/save' yourfile

image

What is the actual behavior?

Show the command you ran and the actual output. Include the --debug flag in
your invocation of ripgrep.

https://gist.github.com/Vagelis-Prokopiou/81825543448057468f2fcfed99fdb7f2

What is the expected behavior?

It should have found the pattern, just like grep does.

$ grep -r '/form/save' packages/local
packages/local/dfe-view-formcontainer/src/view/FormContainerController.js:            '/form/save',
@BurntSushi
Copy link
Owner

The first line in the debug output gives you a hint as to what's going on:

DEBUG|grep_regex::literal|C:\Users\vangelisp\.cargo\registry\src\github.com-1ecc6299db9ec823\grep-regex-0.1.9\src\literal.rs:58: literal prefixes detected: Literals { lits: [Complete(C:/Users/vangelisp/Downloads/Programs/PortableGit/form/save)], limit_size: 250, limit_class: 10 }

That leading slash is getting replaced by something else, presumably in your shell. There is nothing ripgrep can do about this AFAIK.

In any case, this is a duplicate of #1667. And it looks like it contains a work-around. Try rg --path-separator //?

I don't know how grep is avoiding this problem, but it's plausible that it has been compiled in a way that prevents these issues. It's unlikely that a similar solution will work for ripgrep.

@BurntSushi BurntSushi added the duplicate An issue that is duplicative of another. label Aug 17, 2021
@Vagelis-Prokopiou
Copy link
Author

Aha.

Thanx a lot for the feedback dear Andrew, and sorry for missing the duplicate issue :-)

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