正規表現関数-REGEXP_SUBSTR

1413 ワード

Oracle        -REGEXP_SUBSTR      .
5   

          

         

                     。(   1)

            。(   1)

         :

i:      ;

c:     ;

n:   .        ;

m:    ;

x:    ,             。

 

      
SQL> select * from test_reg_substr;

A

-----------------------------------

ABC123XYZ

ABC123XYZ456

Edward

 

       
SQL> SELECT

 2    REGEXP_SUBSTR(a,'[0-9]+')

 3  FROM

 4    test_reg_substr

 5  WHERE

 6    REGEXP_LIKE(a, '[0-9]+');

REGEXP_SUBSTR(A,'[0-9]+')

---------------------------------

123

123

 

       (          ,  2     )
SQL> SELECT

 2    NVL(REGEXP_SUBSTR(a,'[0-9]+',1, 2), '-') AS a

 3  FROM

 4    test_reg_substr

 5  WHERE

 6    REGEXP_LIKE(a, '[0-9]+');

A

------------------------------------------------------

-

456

 

  “    ”
SQL> SELECT

 2    REGEXP_SUBSTR(a, '\w+')

 3  FROM

 4    test_reg_substr

  5  WHERE

 6    REGEXP_LIKE(a, '\w+');

REGEXP_SUBSTR(A,'\W+')

-------------------------------

ABC123XYZ

ABC123XYZ456

Name

 

  “    ”(          ,  2     )
SQL> SELECT

 2    NVL(REGEXP_SUBSTR(a, '\w+',1, 2), '-') AS a

 3  FROM

 4    test_reg_substr

  5  WHERE

 6    REGEXP_LIKE(a, '\w+');

 A

---------------------------------------------------

 -

-

Edward