Users Guide

Table Of Contents
Dell PowerConnect ArubaOS 5.0 | User Guide External Services Interface | 595
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.
References
This implementation is based, in part, on the following resources:
z Lonvick, C., “The BSD syslog Protocol”, RFC 3164, August 2001
z Regular expression (regex) reference: http://en.wikipedia.org/wiki/Regular_expression
z Regex syntax summary: http://www.greenend.org.uk/rjk/2002/06/regexp.html
z Basic regular expression (BRE) syntax: http://builder.com.com/5100-6372-1050915.html
Table 128 Regular expression anchors
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.