REGEXP_LIKE - finding double vowels [message #486273] |
Tue, 14 December 2010 10:17  |
 |
DataMouse
Messages: 31 Registered: December 2010 Location: New York, NY - United Sta...
|
Member |
|
|
I am reading Section 4-8 (page 42/216) in the Oracle Database 2-day Developer Guide from here: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10766.pdf
It reads:
Suppose that you want to select every employee whose last name has a double vowel(two adjacent occurrences of the same vowel).
Example 4.9 shows how you can do this.
The regular expression ([AEIOU]) represents any vowel. The metacharacter \1 represents the first (and in this case, only) regular expression. The third function parameter, 'i', specifies that the match is case-insensitive.
Example 4.9 Selecting All Employees Whose Last Names Have Double Vowels
SELECT FIRST_NAME, LAST_NAME
FROM EMPLOYEES
WHERE REGEXP_LIKE(LAST_NAME, '([AEIOU])\1', 'i');
Result is similar to:
FIRST_NAME LAST_NAME
-------------------- -------------------------
Harrison Bloom
Lex De Haan
Kevin Feeney
Ki Gee
Nancy Greenberg
Danielle Greene
Alexander Khoo
David Lee
8 rows selected.
I don't understand how [AEIOU])\1 would find a double vowel(two adjacent occurrences of the same vowel). Could someone help me understand this?
|
|
|
|
|
|
|
|
|