Regular Expression in the Real World: Regular Expression in the Real World: egrep
CSC360- Tutorial
Gur Saran Adhar

egrep: the extended global regular expression print in Unix allows to search for a string or complex patterns in a file. Regular expressions provide a convenient, compact way of expressing patterns.

Regular expressions in egrep are written slightly dofferently. For example, Kleen closure operator(*) is written as * (not superscript), union (È) is denoted by verticle bar (\mid). Parentheses have their usual meaning as grouping operators. The alphabet (å) is denoted by a period (.), i.e., matches any character.

For example, the regular expression (abÈc)* would be denoted as (ab \mid c)*, and å* would be denoted as .*

There is no way to express the empty string in egrep. Instead, r? denotes zero or more occurences of the regular expression r, so the empty string is not needed in practice.

Special characters beginning of line is denoted by ^
and end of line is denoted by $

Expression egrep notation
r* r*
r+ r+
r Èl r?
r Ès r\mid s
rs rs
(r) (r)
å .


File translated from TEX by TTH, version 2.25.
On 13 Sep 1999, 09:58.