ArticleDirectory
Regular Expressions in oraclewith 10g, regular expressions are finally available in SQL. That is, they were already supported through the specified package. The new operators and functions are regexp_like
symbol |
matches |
. |
Any character t newline |
^ |
Start of a line |
$ |
end of a line |
* |
0, 1, or more of the preceding element. The preceding element can be grouped with () |
{n} |
EXACTLY n repetitions of the preceding element. The preceding element can be grouped with () |
{n ,} |
matches N or more repetitions of the preceding element. The preceding element can be grouped with () |
{m, n} |
matches between M and N repetitions of the preceding element. The preceding element can be grouped with () |
[ABC] |
Character List, matches A, B or C. |
[G-l] |
G, H, I, J, K, or l |
| |
groups alternatives |
Character classesthe following character classes are suppored:
- [[: Alnum:]
Alphanumeric characters
- [[: Alpha:]
Alphabetic Characters
- [[: Blank:]
Blank space characters
- [[: Cntrl:]
Control characters
- [[: Digit:]
0 through 9, or[0-9]
- [[: Graph:]
[[: Punct:] + [[: Upper:] + [[: lower:] + [[: digit:]
- [[: Lower:]
Lowercase alphabetic characters
- [[: Print:]
Printable characters
- [[: Punct:]
Punctuation characters
- [[: Space:]
Non-printing space characters
- [[: Upper:]
Uppercase Alphabetic Characters
- [[: Xdigit:]
Hexadecimal characters
Character classes can be
Negated :
[^ [: Char-class:] . Equivalence classesfor example, the following not only matches
A , But also
Ä .
[[= A =]
Links
Http://www.adp-gmbh.ch/blog/2005/december/22.html