Xman Blog Inside

Monday, September 04, 2006

Regular Expression Quick Reference



.Match single character except newline.
x*Match zero or more x.
[xyz]Match a character from x, y or z.
[^xyz]Match any single character except x, y, or z.
[a-zA-Z0-9]Match a character from a to z, A to Z, or 0 to 9 inclusive.
^xMatch x at beginning of the line.
x$Match x at end of the line.
x\{2,4\}Match 2 to 4 x inclusive.
x+Match one or more x.
x?Match zero or one x.
x|yMatch either x or y.
\Escapes the special character e.g. \t => TAB, \n => newline.
()Groups regular expressions e.g. (x|y)+.


Reference: UNIX Power Tools: sed & awk by Dale Dougherty

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home