Friday, June 27, 2008

Regular Expressions: Special Characters And Escape Sequences

Regular Expressions: Special Characters And Escape Sequences

Special Characters

"^" Beginning of text
"$" End of text
"." Any single character but (\n) the newline
"*" Previous expression 0 or more times
"+" Preceding character 1 or more times
"?" Preceding character 0 or 1 times
"" Alteration used in Groups
"(" Used in Groups
")" Used in Groups
"[" Used in Ranges
"]" Used in Ranges
"-" Used in Groups and Ranges
"{" Used in Quantifiers
"}" Used in Quantifiers


Escape Sequences

"\b" Word boundary
"\B" Any non Word boundary

"\d" Any digit
"\D" Any non digit

"\s" Any whitespace character; space, tab, newline
"\S" Any character that is not whitespace

No comments: