-
regexp in oracle 10g
hi pls explain me clearly how operaters in regexp works.
SELECT REGEXP_INSTR('500 Oracle Pkwy, Redwood Shores, CA', '[o][[:alpha:]]{4}', 1, 1, 0, 'i') RESULT
FROM dual
0/p is----> 5
WITH t AS
(SELECT '123-4567' phone FROM dual
UNION
SELECT '01 345678' FROM dual
UNION
SELECT '7 87 8787' FROM dual)
SELECT t.phone, REGEXP_REPLACE(REGEXP_REPLACE(phone, '[^0-9]'), '(.{3})(.*)', '(\1)-\2')
FROM t
o/p is -->
PHONE REGEXP_REPLACE(REGEXP_REPLACE(
01 345678 (013)-45678
123-4567 (123)-4567
7 87 8787 (787)-8787
Thanks in advance.
-
Re: regexp in oracle 10g
Syntax ------------- [code] regexp_instr(x,pattern[,start[,occurance[,return_option[,match_option]]]]) [/code] note--match options are
c-case sensitive.
I-not case sensitive.
N-allows to use match-any-character operator.
M-treates x as multiline.
[code] select regexp_instr('debasis das','d[[:alpha:]]{2}',1,2)from dual;[/code]
-
Re: regexp in oracle 10g