Contents
Is there a way to escape the backslash with regex?
To search for a star or plus, use [+*]. Your regex will work fine if you escape the regular metacharacters inside a character class, but doing so significantly reduces readability.
How to do search and replace with regular expressions?
1299465 | 2003415 | 2015-09-06 05:35:34.59662+02 1299449 | 2009400 | 2015-09-06 05:35:32.301683+02 1299450 | 2008465 | 2015-09-06 05:35:32.451393+02 1299457 | 2015211 | 2015-09-06 05:35:33.451049+02 How can I do this with gedit? Background: I want to do it with gedit and not sed/python/…. since the replace needs to be done interactive.
Can a backslash be included in a character class?
Your regex will work fine if you escape the regular metacharacters inside a character class, but doing so significantly reduces readability. To include a backslash as a character without any special meaning inside a character class, you have to escape it with another backslash. [\\x] matches a backslash or an x.
How to do search and replace in gedit?
Background: I want to do it with gedit and not sed/python/…. since the replace needs to be done interactive. Search for: .*\\| (.*) \\|.* This is on Gedit 3.10.4, the default version in Ubuntu 14.04. You can use the plugin advanced-find for gedit. Install the plugin from here. Then, use Oli’s answer to strip the numbers you want from your question.
Which is the escape character in regex string?
In the string representation of your regex, you have “\\\\”, Which is what gets sent to the parser. The parser will see \\ which it interprets as a valid escaped-backslash (which matches a single backslash). The backslash is the escape character for regular expressions.
Which is the escape character for a backslash?
The backslash \\ is the escape character for regular expressions. Therefore a double backslash would indeed mean a single, literal backslash. \\ (backslash) followed by any of [\\^$.|?*+ () {} escapes the special character to suppress its special meaning.
Can you escape the hyphen with a backslash?
The closing bracket (]), the caret (^) and the hyphen (-) can be included by escaping them with a backslash, or by placing them in a position where they do not take on their special meaning. I recommend the latter method, since it improves readability.
How to remove backslash escaping from a JavaScript var?
Other answers have you delete all backslashes, you only want to delete the ones befoew the quotes. You need to make there be one backslash instead of three. This function will not simply remove slashes. Text compiles as code, and in case correct input, you get right unescaping result for any escape sequence.