Timeline for Using fixed strings in regular expressions?
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 25, 2019 at 10:27 | comment | added | Socowi | This can fail if the variable $EMAIL contains a literal \E. Here's an example: x='\E^a'; printf %s\\n "$x" a | grep -P "\Q$x\E". Grep doesn't match the value $x but matches the string a which is different from $x. | |
| Apr 15, 2015 at 11:13 | comment | added | JJoao | In bash both ...$) and ...\$) work. Escaping is shell dependent. \Q...\E is document in any tutorial about perl-like regexp. See also the "quotemeta" link of @choroba comment. | |
| Apr 15, 2015 at 10:15 | comment | added | SJU | Don't you need to escape the $? Also, where are \Q and \E documented? | |
| Apr 14, 2015 at 15:20 | history | answered | JJoao | CC BY-SA 3.0 |