Results 1 to 3 of 3

Thread: regexp in oracle 10g

  1. #1
    Contributing Member
    Join Date
    Apr 2006
    Answers
    46

    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.


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: regexp in oracle 10g

    Syntax -------------
    Code:
     regexp_instr(x,pattern[,start[,occurance[,return_option[,match_option]]]])
    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;



  3. #3
    Contributing Member
    Join Date
    Apr 2006
    Answers
    46

    Re: regexp in oracle 10g

    thank you sir


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact