Regular expression [message #412241] |
Wed, 08 July 2009 06:10  |
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 #412257 is a reply to message #412241] |
Wed, 08 July 2009 06:49   |
_jum
Messages: 577 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='-'
|
|
|
|