User's Manual
1017 | External Services Interface Dell Networking W-Series ArubaOS 6.4.x| User Guide
Operator Description Sample Result
? Match any character one
time if it exists
egrep “?erd” sample text Matches berd, herd, etc., erd
* Match declared element
multiple times if it exists
egrep “n.*rd” sample.txt Matches nerd, nrd, neard, etc.
+ Match declared element one
or more times
egrep “[n]+erd” sample.txt Matches nerd, nnerd, etc., but
not erd
{n} Match declared element
exactly n times
egrep “[a-z]{2}erd”
sample.txt
Matches cherd, blerd, etc., but
not nerd, erd, buzzerd, etc.
{n,} Match declared element at
least n times
egrep “.{2,}erd” sample.txt Matches cherd and buzzerd, but
not nerd
{n,N} Match declared element at
least n times, but not more
than N times
egrep “n[e]{1,2}rd”
sample.txt
Matches nerd and neerd
Table 221: Regular expression repetition operators
Regular Expression Anchors
Anchors describe where to match the pattern, and are a handy tool for searching for common string
combinations. Some of the anchor examples use the vi line editor command:s, which stands for substitute.
That command uses the syntax: s/pattern_to_match/pattern_to_substitute.
Operator Description Sample Result
^ Match at the beginning of a
line
s/^/blah/ Inserts “blah” at the beginning
of the line
$ Match at the end of a line s/$/blah/ Inserts “blah” at the end of the
line
\< Match at the beginning of a
word
s/\</blah/ Inserts “blah” at the beginning
of the word
egrep “\<blah”
sample.txt
Matches blahfield, etc.
\> Match at the end of a word s/\>/blah/ Inserts “blah” at the end of the
word
egrep “\>blah”
sample.txt
Matches soupblah, etc.
\b Match at the beginning or end
of a word
egrep “\bblah”
sample.txt
Matches blahcake and
countblah
\B Match in the middle of a word egrep “\Bblah”
sample.txt
Matches sublahper, etc.
Table 222: Regular expression anchors
References
This implementation is based, in part, on the following resources: