Home » SQL & PL/SQL » SQL & PL/SQL » REGEXP_LIKE - finding double vowels
REGEXP_LIKE - finding double vowels [message #486273] Tue, 14 December 2010 10:17 Go to next message
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?
Re: REGEXP_LIKE - finding double vowels [message #486277 is a reply to message #486273] Tue, 14 December 2010 10:45 Go to previous messageGo to next message
_jum
Messages: 577
Registered: February 2008
Senior Member
[AEIOU]      finds one vowel
([AEIOU])    groups this for backreferenz
([AEIOU])\1  finds a double vowel, the first and the identical as backreferenz \1
'i'          'i' specifies case-insensitive matching (capitals and little vowels)

[Updated on: Tue, 14 December 2010 10:45]

Report message to a moderator

Re: REGEXP_LIKE - finding double vowels [message #486278 is a reply to message #486277] Tue, 14 December 2010 10:49 Go to previous messageGo to next message
DataMouse
Messages: 31
Registered: December 2010
Location: New York, NY - United Sta...
Member
Thank you! I wish they would've just showed that in the PDF!

Edit: Where did you find that?

[Updated on: Tue, 14 December 2010 10:52]

Report message to a moderator

Re: REGEXP_LIKE - finding double vowels [message #486283 is a reply to message #486278] Tue, 14 December 2010 11:08 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9106
Registered: November 2002
Location: California, USA
Senior Member
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_regexp.htm#i1007670
Re: REGEXP_LIKE - finding double vowels [message #486284 is a reply to message #486283] Tue, 14 December 2010 11:14 Go to previous messageGo to next message
DataMouse
Messages: 31
Registered: December 2010
Location: New York, NY - United Sta...
Member
Tyvm.
Re: REGEXP_LIKE - finding double vowels [message #486286 is a reply to message #486284] Tue, 14 December 2010 11:18 Go to previous messageGo to next message
Michel Cadot
Messages: 68770
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Tyvm? Not found in my dictionary.
Once again, read forum guide and follow it.
Do you think you are so superior that you should not consider to write whole words to thank those who help you?

Regards
Michel

[Updated on: Tue, 14 December 2010 11:20]

Report message to a moderator

Re: REGEXP_LIKE - finding double vowels [message #486295 is a reply to message #486286] Tue, 14 December 2010 11:54 Go to previous message
DataMouse
Messages: 31
Registered: December 2010
Location: New York, NY - United Sta...
Member
http://acronyms.thefreedictionary.com/TYVM

Thank you very much, Barbara Boehmer.

[Updated on: Tue, 14 December 2010 11:55]

Report message to a moderator

Previous Topic: RSI Calculation using PL/SQL (merged)
Next Topic: duplicate entries/double booking plsql (3 merged)
Goto Forum:
  


Current Time: Sun Sep 07 19:47:37 CDT 2025