7-SQL (Regular Expressions)
7-SQL (Regular Expressions)
(Regular
Expressions)
Sign Pattern Description
^ '^ra' ^ sign represents
beginning of string.
Beginning of string
should contain “ra”.
$ 'an$' $ sign represents end of
string.
End of string should
contain “an”.
[…] '[rms]' String should contain any
character listed between
square brackets.
^[…] '^[rms]' String should begin with
any character listed
between the square
brackets.
[…]$ '[rms]$' String should end with
any character listed
between the square
brackets.
[a-z] '[a-h]e' String should contain any
character between “a”
and “h”, with the
succeeding character
being “e”.
^[a-z] '^[a-h]e' String should start with
any character between
“a” and “h”, with the
succeeding character
being “e”.
[a-z]$ '[a-h]e$' String should end with
any character between
“a” and “h”, with the
succeeding character
being “e”.
pattern 'tom' String should contain
“tom”.
pattern1|pattern2|pattern3 'tom|dick|harry' String should match any
of the patterns.
String should contain
either “tom” or “dick” or
“harry” or any of the two
or all three.
Example1: 'tom|[rms]|[a-h]e' String should match any
pattern1|pattern2|pattern3 of the patterns.
Example2: '^ra|^[rms]|^[a-h]e' String should match any
pattern1|pattern2|pattern3 of the patterns.
Example3: 'an$|[rms]$|[a-h]e$' String should match any
pattern1|pattern2|pattern3 of the patterns.
SQL Queries: