Users Guide

Table Of Contents
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 249: 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
Table 250: Regular expression anchors
Dell Networking W-Series ArubaOS 6.5.x | User Guide External Services Interface | 1062