Wednesday, August 24, 2005

Regular Expression

A few notes for my regex needs.
^ Start of String
$ End of string
\ Escape the next character; interpret it literally
n* Zero or more of 'n'
n+ One or more of 'n'
n? A possible 'n'
n{2} Exactly two of 'n'
n{2,} At least 2 or more of 'n'
n{2,4} From 2 to 4 of 'n'
() Parenthesis to group substrings
(na) Either 'n' or 'a'
. Any single character
[1-6] A number between 1 and 6
[c-h] A lower case character between c and h
[D-M] An upper case character between D and M
[^a-z] Absence of lower case a to z
[_a-zA-Z] An underscore or any letter of the alpha

No comments: