Regular Expressions

Top  Previous  Next

Regular expression is a notation for patterns of text, as opposed to exact strings of characters. The notation uses literal characters and metacharacters. Every character which does not have special meaning in the regular-expression syntax is a literal character and matches an occurrence of that character. For example, letters and numbers are literal characters. A metacharacter is a symbol with special meaning (an operator or delimiter) in the regular-expression syntax.


Wildcard: any character


Repeat: zero or more occurrences of previous character or class


Line position: beginning of line


Line position: end of line


Character class: any character in the set


Inverse class: any character not in the set


Range: any characters within the specified range


Escape: literal use of metacharacter x


Word position: beginning of the word


Word position: end of the word

For example, the following regular expression .* matches any string of characters, ^a matches any string beginning with character a.