Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> Regular Expression Problem

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: Regular Expression Problem
 Lyad  Posted: Feb 01, 2007 05:11:45 AM

 Total Post: 12
 Joined: Jan, 2007






 Can anyone tell me How should I use regular expression to check a string containing only alphabet and number.
The thing I need is :
I allow 'aA3 d', 'Aa4 ', '5 A_bc', '5 A B- C' i.e. all possibble combination with apace,alphabet(both cases),and number and '-' or '_'.
except -,_,and space not as first character
But I don't allow !,%,*,(,.,/,},{,(,",+,=,<,>, at any position.

Could anybody help me regarding this.



 Lyad
Posted: Feb 01, 2007 12:23:39 PM  

 Total Post: 12
 Joined: Jan, 2007






 
One thing I forgot to mention is I need to allow \' apostrophe also.
Thanks.

 ankur
Posted: Feb 02, 2007 02:29:36 AM  

 Total Post: 59
 Joined: Nov, 2006






 
use the escape character ............


Specify Escape in the query and the character as '\' or '_'

whatever u want to allow

 ebrian
Posted: Feb 03, 2007 12:12:04 AM  

 Total Post: 1
 Joined: Feb, 2007






 
This should work for you:

[code]SQL> select * from foo;

A1
--------------------
aA3 d
Aa4
5 A_bc
5 A B- C
-ABC
12'YZ
A!B

7 rows selected.

SQL> select * from foo
2 where regexp_like(a1, '^[[:alnum:]](\w|[''_ ])+', 'i');

A1
--------------------
aA3 d
Aa4
5 A_bc
5 A B- C
12'YZ[/code]

 Lyad
Posted: Feb 05, 2007 04:33:51 AM  

 Total Post: 12
 Joined: Jan, 2007






 
Thank You.

 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar856
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gitesh Trivedi322
  Gopu Gopi281
  neeraj sharma254
  Ramesh Jois245
  Bishal Khetan207






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software