Home » SQL & PL/SQL » SQL & PL/SQL » Regular expression (oracle10g)
Regular expression [message #412241] Wed, 08 July 2009 06:10 Go to next message
convey05
Messages: 43
Registered: December 2007
Location: CHENNAI
Member
Hi
In my program i am using regular expression condition
like 
REGEXP_LIKE(TRIM(col1),'^[a-zA-Z]{4}[0-9]')

in the program where i am going to use this regular expression has already ^ symbol and they
are replacing this with ''''.
when i use the regular expression ^ is also getting replaced.
can any one tell me how to use this without disturbing the existing code

with thanks

Re: Regular expression [message #412244 is a reply to message #412241] Wed, 08 July 2009 06:13 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I'm afraid I don't understand what you're saying.

Regexp_Like doesn't replace anything.
Re: Regular expression [message #412257 is a reply to message #412241] Wed, 08 July 2009 06:49 Go to previous messageGo to next message
_jum
Messages: 509
Registered: February 2008
Senior Member
REGEXP_REPLACE will replace text. But it only replaces a caret '^' if You mask the caret '\^'. See the three eaxamples below:
select REGEXP_REPLACE('ABCD1','^[a-zA-Z]{4}[0-9]','-') rep from dual;
--rep='-'

select REGEXP_REPLACE('^ABCD1','^[a-zA-Z]{4}[0-9]','-') rep from dual;
--rep='^ABCD1'

select REGEXP_REPLACE('^ABCD1','\^[a-zA-Z]{4}[0-9]','-') rep from dual;
--rep='-'

Re: Regular expression [message #412328 is a reply to message #412241] Wed, 08 July 2009 12:52 Go to previous message
coleing
Messages: 213
Registered: February 2008
Senior Member
Try this:- (i think chr94 is a caret). you can check that

REGEXP_LIKE(TRIM(col1),chr(94) || '[a-zA-Z]{4}[0-9]')

[Updated on: Wed, 08 July 2009 12:52]

Report message to a moderator

Previous Topic: Compilation error PLS-00410: duplicate fields in RECORD,TABLE or argument
Next Topic: Compare data and insert unique data (merged)
Goto Forum:
  


Current Time: Fri Dec 09 19:22:30 CST 2016

Total time taken to generate the page: 0.08555 seconds