Oracle10g provides four regular expression functions: regexpfunction: REGEXP_LIKE, REGEXP_REPLACE, REGEXP_INSTR, REGEXP_SUBSTR.
Oracle 10g provides four regular expression functions: regexp function: REGEXP_LIKE, REGEXP_REPLACE, REGEXP_INSTR, REGEXP_SUBSTR.
Oracle 10g provides four regular expression functions: regexp function: REGEXP_LIKE, REGEXP_REPLACE, REGEXP_INSTR, REGEXP_SUBSTR.
REGEXP_LIKE: (matched) checks whether a string matches a regular expression.
(Srcstr, pattern [, match_option])
REGEXP_INSTR: (contained) searches for regular expressions in the string and returns the matched position.
(Srcstr, pattern [, position [, occurrence [, return_option [, match_option])
REGEXP_SUBSTR: (extracted) returns the substring that matches the regular expression.
(Srcstr, pattern [, position [, occurrence [, match_option])
REGEXP_REPLACE: (replace) search and replace the matching Regular Expression
(Srcstr, pattern [, replacestr [, position [, occurrence [, match_option])
Srcstr: The character data to be searched.
Pattern: regular expression.
Occurrence: the number of occurrences. The default value is 1.
Position: Start position
Return_option: The default value is 0, and the start position of the mode is returned. If the value is 1, the start position of the next character that meets the matching conditions is returned.
Replacestr: Used to replace matching strings.
Match_option: Matching Method option. The default value is c.
C: case sensitive
I: case insensitive
N :(.) match any character (including newline)
M: When a string contains a line break, it is processed as multiple rows.
######################################## ######################################## ##
A regular expression is composed of the following standard metacharacters:
[[: Alpha:] any letter. [A-Za-z]
[[: Digit:] any number. [0-9]
[[: Alnum:] Any letter or number. A-Za-z0-9
[: Blank:] []. The standard is space and TAB, but there is only space in Oracle!
[: Cntrl:] CONTROL Key
[: Graph:] All visible characters, excluding spaces
[: Print:] printable characters, I .e. space + all visible characters
[[: Space:] blank characters.
[[: Punct:] Any punctuation marks.
[[: Upper:] Any uppercase letter. A-Z
[[: Lower:] Any lowercase letter. [A-z]
[[: Xdigit:] Any hexadecimal number, which is equivalent to [0-9a-fA-F].
#######
[: Class:] character class. Class, such as alnum and digit.
[. Element.] sorting class. Affected by NLS_SORT. Treat multi-byte characters as single-byte characters. For example, in Spanish, ch and ll are single-byte values expressed in multiple bytes.
[= Char =. In the current language (Locale), match all the characters specified by similar characters such as the same POSIX. For example, in Spanish, [[= n =] specifies the equivalent character n, which can match El Ni? N and ?.
######################################## ###################################
Boundary set
^ The beginning of each line. In single line mode, it is equivalent to the start of a string.
$ The end of each line. In single line mode, it is equivalent to the end of a string.
In single row mode, ^ is equivalent to \ A, and $ is equivalent to \ Z.
######################################## ##################################
Repeated times set
* Matches zero or multiple times-as many times as possible
? Zero or once
+ One or multiple
{M }? Exactly m times, greedy and non-greedy
{M ,}{ m ,}? At least m times
{M, n} {m, n }? Min m up to n times
After the preceding characters, add ?, For example :*?, It is a non-Greedy mode.
Greedy mode will get as many characters as possible, rather than greedy mode will get as few characters as possible
######################################## #######################
For more details, please continue to read the highlights on the next page:
Recommended reading:
Proficient in regular expressions (version 3rd) PDF
Replace () for Oracle Functions ()
Oracle Functions
Differences in case and decode usage and Performance Comparison of Oracle Functions
Simple Oracle functions and stored procedures