Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 Oracle PL/SQL: Regular Expressions - RegExp examples #2 Jump to:  
Category: >> Oracle PL/SQL >> Regular Expressions - RegExp examples #2 Bookmark and Share

<< lastnext >>

Snippet Name: Regular Expressions - RegExp examples #2

Description: Search for control (non-printing) characters using the first example.

Search for digits using the second example.

Search for lowercase characters using the third example.

Search for UPPERCASE characters using the fourth example.

Search for lowercase characters using the fifth example.

Search for any printable characters using the sixth example.

Search for whitespace characters using the seventh example.

Search for characters in a specific position in the string using the eighth example.

Also see:
» Regular Expressions - REGEXP_SUBSTR
» Regular Expressions - REGEXP_LIKE
» Regular Expressions - REGEXP_REPLACE
» Regular Expressions - RegExp examples ...
» Regular Expressions - RegExp examples...
» Regular Expressions - Regexp Cheat She...
» RegExp - Append first name first lette...

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 12th, 2009

SELECT FROM <table_name>
WHERE REGEXP_LIKE(<column_name>, '[[:<POSIX_CHAR_CODE:]]');
 
-- example to search for a TAB character (ASCII 9):
SELECT *
FROM sandbox
WHERE REGEXP_LIKE(regex_test, '[[:TAB:]]{1}');
 
 
-- example to search for any 2 digits
SELECT *
FROM sandbox
WHERE REGEXP_LIKE(regex_test, '[[:digit:]]{2}');
 
 
-- example to search for lowercase characters
SELECT *
FROM sandbox
WHERE REGEXP_LIKE(regex_test, '[[:lower:]]');
 
 
-- or, search for UPPERCASE characters. In this 
-- case we're looking for four (4) characters 
SELECT *
FROM sandbox
WHERE REGEXP_LIKE(regex_test, '[[:upper:]]{4}');
 
 
-- example to search for printable characters
-- this example looks for three printable characters 
-- as specified by the '{3}' quantifier 
SELECT *
FROM sandbox
WHERE REGEXP_LIKE(regex_test, '[[:print:]]{3}');
 
 
-- example to search for whitespace characters. 
-- this includes space, tab, NL, FF, VT, and CR. 
SELECT *
FROM sandbox
WHERE REGEXP_LIKE(regex_test, '[[:space:]]');
 
-- search for a 'Q' in the fourth position. 
-- notice the start-of-line anchor, '^' is used. 
SELECT * 
FROM sandbox
WHERE REGEXP_LIKE(regex_text, '^...Q.');


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 199 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?