Regular Expressions
Regular Expressions
Example
{N}
w{3} matches
www.Informatica.com
60{2,5} matches
600,6000,600000
Character Class
Meaning
[aeiou]
[^aeiou]
[0-9a-fA-F]
\w
\W
\s
\S
\d
\D
A regular expression is a string that uses a standard syntax to define a search pattern. The syntax
is similar to a wildcard search, but with greatly enhanced search capabilities.
Consider, for example, the following text:
Peter Piper picked a peck of pickled peppers
The following are illustrations of regular expressions and the strings that they retrieve from the
above text.
Regular expression
Peter
Pip.+cked
[Pp]i[a-k]{3}
The following table lists special characters that you can use in regular expressions. The table is
not comprehensive. There are other syntax combinations that have special meanings in regular
expressions.
Character
(asterisk)
(question)
Character
(plus)
{}
(braces)
[]
(brackets)
(minus)
(period)
(caret)
(dollar)
(bar)
()
(parentheses)
(backslash)
e
r
e
g
u
l
a
r
e
x
p
r
e
s
si
o
n
$
1
t
o
i
d
e
n
ti
f
y
t
h
e
s
u
b
st
ri
n
g
t
h
a
t
m
a
t
c
h
e
s
t
h
e
fi
r
st
p
a
r
e
n
t
h
e
si
z
e
d
p
o
rt
i
o
n
o
f
t
h
e
r
e
g
u
l
a
r
e
x
p
r
e
s
si
o
n
$
2
,
$
3
,
a
n
d
s
o
f
o
rt
h
,
t
o
i
d
e
n
ti
f
y
t
h
e
s
u
b
st
ri
n
g
s
t
h
a
t
m
a
t
c
h
t
h
e
s
e
c
o
n
d
,
t
h
ir
d
,
e
t
c.
p
a
r
e
n
t
h
e
si
z
e
d
p
o
rt
i
o
n
s
For example, suppose you set:
exp = abc([0-9]+)(def)
replacement = $1