0% found this document useful (0 votes)
140 views1 page

Regex Cheat Sheet: Meta Characters - What Meta Characters Mean

RegEX Cheat Sheet provides a summary of common meta characters and syntax used in regular expressions. The meta characters include brackets, backslash, caret, dollar sign, pipe symbol, question mark, asterisk, plus sign, parentheses and hyphen. Other useful syntax includes character classes, backreferences, line breaks, word boundaries and repetition quantifiers. The cheat sheet is intended to define what each meta character and syntax element means to help users write regular expressions.

Uploaded by

Anupam Lalit
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
140 views1 page

Regex Cheat Sheet: Meta Characters - What Meta Characters Mean

RegEX Cheat Sheet provides a summary of common meta characters and syntax used in regular expressions. The meta characters include brackets, backslash, caret, dollar sign, pipe symbol, question mark, asterisk, plus sign, parentheses and hyphen. Other useful syntax includes character classes, backreferences, line breaks, word boundaries and repetition quantifiers. The cheat sheet is intended to define what each meta character and syntax element means to help users write regular expressions.

Uploaded by

Anupam Lalit
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

RegEX Cheat Sheet

Meta Characters - [,\,^,$,.,|,?,*,+, ( ,), -. What Meta Characters mean [ ] \ ^ Opens a character class Closes a character class Delimits the following character or can be used like this \xFF to define a character by its hexadecimal value Inside of a character class this indicates that the next character is negated and outside indicates that the pattern is tied to the beginning of the line $ . | ? * + ( Ties a pattern to the end of a line Matches any character except a line break, it is considered lazy and not good form to use this Used to indicate an XORed set of possible pattern matches Makes the proceeding term optional, so abc? Will match ab or abc Repeats the proceeding item 0 or more times, so .* matches def and ghi in abc def ghi jkl Repeats the previous item one or more times, so \d+ matches 111 in 111 12a 12b Creates a back reference, essentially used to store something in a variable(may or may be implemented in the RegEX engine you are using) ) Closes a back reference Indicates a range in a character class, [0-9] matches a single digit from 0 to 9

Other useful RegEx syntax \n \r Matches a Line Feed/New Line Matches a Carriage Return(NOTE: For UNIX only the \n is necessary to indicate the end of a line, but for Microsoft \n\r is necessary) \t \s \d \w Matches a tab character Matches white space Matches a digit Matches letters or digits in some implementations of RegEx engines

NOTE: Any of the above capitalized negates it, or makes it match the opposite, except \r, \n, and \t \A \Z \b {n} Matches the beginning of a string Matches the end of a string Matches at the position between a word character and a non-word character Repeats the previous pattern n number of times

{n,m} Repeats the previous pattern between n and m times where n is the minimum and m is the maximum

You might also like