Timeline for Why do I have to quote an escaped character in a regular expression for grep, but not on online regex engines?
Current License: CC BY-SA 4.0
Post Revisions
18 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 15, 2020 at 15:56 | vote | accept | dbates | ||
| May 1, 2020 at 18:30 | answer | added | ilkkachu | timeline score: 1 | |
| Apr 30, 2020 at 17:34 | vote | accept | dbates | ||
| Apr 30, 2020 at 17:34 | |||||
| Apr 30, 2020 at 6:57 | history | became hot network question | |||
| Apr 30, 2020 at 6:19 | comment | added | Sundeep | see mywiki.wooledge.org/Quotes to learn about various quoting in bash, wrt resources for learning regex specific to grep, I have book (currently free) if you are using GNU grep - github.com/learnbyexample/learn_gnugrep_ripgrep (though there are a few things I need to update/correct) | |
| Apr 30, 2020 at 5:54 | comment | added | Olivier Dulac | @dbates I provided an answer to make the need of 2 backslashes to have grep receive a single backslash a bit clearer, and advise on why you should use singlequoting most things (or doublequote when you need to interpret variables or subcommands) | |
| Apr 30, 2020 at 5:41 | answer | added | Olivier Dulac | timeline score: 14 | |
| Apr 30, 2020 at 4:27 | history | edited | muru | CC BY-SA 4.0 |
damn mobile keyboards
|
| Apr 30, 2020 at 2:02 | history | edited | muru | CC BY-SA 4.0 |
edited title
|
| Apr 30, 2020 at 1:57 | answer | added | Nasir Riley | timeline score: 2 | |
| Apr 30, 2020 at 0:29 | comment | added | jsotola |
that is not quite it ... the second \ is literal ... it does not escape the .
|
|
| Apr 29, 2020 at 23:54 | answer | added | Hauke Laging | timeline score: 9 | |
| Apr 29, 2020 at 23:14 | comment | added | dbates | Okay, got it. one \ so that grep treats . as a literal rather than a meta character, and another \ so that the shell actually passes \. along for grep to see in the first place. I'll have to dig into this a bit more. Thanks. | |
| Apr 29, 2020 at 23:08 | review | First posts | |||
| Apr 30, 2020 at 5:32 | |||||
| Apr 29, 2020 at 23:01 | comment | added | choroba | The shell processes the parameters before grep gets to see them. You don't need to learn how regexes in grep are different to regexes in JavaScript only, you also need to learn how the shell works. | |
| Apr 29, 2020 at 23:01 | comment | added | Andy Dalton |
You're running into issues involving the shell itself. Try echo \. vs echo "\." vs echo \\. and notice the differences. That might help understand why "9\.00" does what you expect but 9\.00 does not.
|
|
| Apr 29, 2020 at 22:57 | history | edited | schrodingerscatcuriosity | CC BY-SA 4.0 |
Text to code
|
| Apr 29, 2020 at 22:56 | history | asked | dbates | CC BY-SA 4.0 |