User:Swapnil durgade/Regular Expressions Notes
(Redirected from Regular Expressions Notes)
c matches the non-metacharacter c. \c matches the literal character c. . matches any character including newline. ^ matches the beginning of a string. $ matches the end of a string. [abc...] character class, matches any of the characters abc.... [^abc...] negated character class, matches any character except abc.... r1|r2 alternation: matches either r1 or r2. r1r2 concatenation: matches r1, and then r2. r+ matches one or more r's. r* matches zero or more r's. r? matches zero or one r's. (r) grouping: matches r. r{n} r{n,} r{n,m} One or two numbers inside braces denote an interval expres- sion. If there is one number in the braces, the preceding regular expression r is repeated n times. If there are two numbers separated by a comma, r is repeated n to m times. If there is one number followed by a comma, then r is repeated at least n times. Interval expressions are only available if either --posix or --re-interval is specified on the command line. \y matches the empty string at either the beginning or the end of a word. \B matches the empty string within a word. \< matches the empty string at the beginning of a word. \> matches the empty string at the end of a word. \w matches any word-constituent character (letter, digit, or underscore). \W matches any character that is not word-constituent. \' matches the empty string at the end of a buffer.