[:punct:] matches punctuation. : Bracketed Special Classes « Regular Expressions Functions « Oracle PL/SQL Tutorial






SQL>
SQL> -- create demo table
SQL> create table myTable(
  2    id           NUMBER(2),
  3    value        VARCHAR(50)
  4  );

Table created.

SQL>
SQL> insert into myTable(id, value)values(1,'1234 4th St. Vancouver');

1 row created.

SQL> insert into myTable(id, value)values(2,'4 Maple Ct. New York');

1 row created.

SQL> insert into myTable(id, value)values(3,'4321 Green Blvd. London');

1 row created.

SQL> insert into myTable(id, value)values(4,'33 Third St. Toronto');

1 row created.

SQL> insert into myTable(id, value)values(5,'One First Drive. Queen');

1 row created.

SQL> insert into myTable(id, value)values(6,'1664 1/2 Springhill Ave');

1 row created.

SQL> insert into myTable(id, value)values(7,'665 Fall Ave. Linken');

1 row created.

SQL>
SQL> select * from mytable;

        ID VALUE
---------- --------------------------------------------------
         1 1234 4th St. Vancouver
         2 4 Maple Ct. New York
         3 4321 Green Blvd. London
         4 33 Third St. Toronto
         5 One First Drive. Queen
         6 1664 1/2 Springhill Ave
         7 665 Fall Ave. Linken

7 rows selected.

SQL>
SQL>
SQL> SELECT value,
  2      REGEXP_INSTR(value,'[[:punct:]]')
  3  FROM myTable
  4  WHERE REGEXP_INSTR(value,'[[:punct:]]') > 0;

VALUE                                              REGEXP_INSTR(VALUE,'[[:PUNCT:]]')
-------------------------------------------------- ---------------------------------
1234 4th St. Vancouver                                                            12
4 Maple Ct. New York                                                              11
4321 Green Blvd. London                                                           16
33 Third St. Toronto                                                              12
One First Drive. Queen                                                            16
1664 1/2 Springhill Ave                                                            7
665 Fall Ave. Linken                                                              13

7 rows selected.

SQL>
SQL>
SQL> drop table myTable;

Table dropped.

SQL>
SQL>








18.8.Bracketed Special Classes
18.8.1.Bracketed Classes
18.8.2.[:digit:] matches all numbers.
18.8.3.The bracketed expression [[:digit]] matches numbers
18.8.4.REGEXP_INSTR(value,'[[:digit:]]')
18.8.5.Matching for a non-digit
18.8.6.[:alnum:] matches all numbers and letters (alphanumerics).
18.8.7.[:alpha:] matches characters only.
18.8.8.[:lower:] matches lowercase characters.
18.8.9.[:upper:] matches uppercase characters.
18.8.10.[:space:] matches spaces.
18.8.11.[:punct:] matches punctuation.
18.8.12.[:print:] matches printable characters.
18.8.13.[:cntrl:] matches control characters.
18.8.14.REGEXP_INSTR(value,'[[:lower:]]')