why doesn't a pattern with /
at the beginning and end work as I would expect?
#2463
-
ripgrep: Non-capturing group doesn't return a value. Example of regexp (PCRE) with a successful result: |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 9 replies
-
Please provide an rg command with input. Show actual output and expected output |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
This is why providing the actual command you're running is so critical. In this case, it has nothing to do with your regex. Instead, here you are putting slashes at the beginning and end of your regex pattern. I don't know why. Just remove them and it works:
If there is some documentation that led you to putting slashes in your regex pattern, I'd love to fix it. Could you please point me to where you thought it was necessary to use slashes? |
Beta Was this translation helpful? Give feedback.
-
Hi, I have a similar problem. I would like search a url that start with '/' (not a pattern) in the files, but I cant't find how escape character Eg:
|
Beta Was this translation helpful? Give feedback.
-
With and without
|
Beta Was this translation helpful? Give feedback.
-
Also in Windows Terminal
But with |
Beta Was this translation helpful? Give feedback.
This is why providing the actual command you're running is so critical. In this case, it has nothing to do with your regex. Instead, here you are putting slashes at the beginning and end of your regex pattern. I don't know why. Just remove them and it works:
If there is some documentation that led you to putting slashes in your regex pattern, I'd love to fix it. Could you please point me to where you thought it was necessary to use slashes?