Enumerator | Represents | Matches | Comment |
{2} | exactly 2 of preceding char or token | exactly 2 | \{2} in Vim, unless magic is set |
{2,13} | from 2 to 13 of preceding char or token | all it can, up to 13 | \{2,13} in Vim, unless magic is set |
{2,} | 2 to infinity of preceding char or token | all it can to end of string | Not in VI.
\{2,} in Vim, unless magic is set |
NOTE: {0,1}Platforms often require \{ for braces, and awk requires the --posix flag in order for braces to work! |
"[0-9]{3}-[0-9]{4}"
Tarball this slideshow
ls -1 | grep "^[0-9]\{1,2\}\.html$" | xargs -p tar -zcvf leap_regex.tgz
|
Copyright (C) 2001 by Steve Litt, you can freely distribute
unmodified copies if this copyright notice and disclaimer are intact.
This material originally appeared on Troubleshooters.Com.
This presentation has no warrantee, express or implied, including,
but not limited to, the implied warranties of merchantability and fitness
for a particular purpose. The entire risk as to the quality and performance
of the presentation is with you. Neither the author nor those who show
the slideshow are responsible for any damage caused by errors, omissions,
or anything else relating to this slideshow.
|