Difference between revisions of "regex guide"
Line 1: | Line 1: | ||
− | [http://regular-expressions.info regular-expressions.info] | + | References taken from [http://regular-expressions.info regular-expressions.info] |
== special chacters == | == special chacters == |
Revision as of 23:31, 13 May 2017
References taken from regular-expressions.info
special chacters
\ ^ $ . | ? * + ( ) [ {
Most regular expression flavors treat the brace { as a literal character, unless it is part of a repetition operator like a{1,3}
Some flavors also support the \Q…\E escape sequence. All the characters between the \Q and the \E are interpreted as literal characters. E.g. \Q*\d+*\E matches the literal text *\d+*.
The backslash in combination with a literal character can create a regex token with a special meaning. E.g. \d is a shorthand that matches a single digit from 0 to 9.
Programming Languages
In your source code, you have to keep in mind which characters get special treatment inside strings by your programming language. That is because those characters are processed by the compiler, before the regex library sees the string.