Writing of the RE with a repeat operator: put in curly brackets {}. : Repitition « Regular Expressions Functions « Oracle PL/SQL Tutorial






Here is an example of repeating the vowel match a second time:

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,'[aeiou]{2}') where_pattern_starts
  3  FROM myTable
  4  WHERE REGEXP_INSTR(value,'[aeiou]{2}') > 0;

VALUE                                              WHERE_PATTERN_STARTS
-------------------------------------------------- --------------------
1234 4th St. Vancouver                                               18
4321 Green Blvd. London                                               8
One First Drive. Queen                                               19

SQL>
SQL>
SQL> drop table myTable;

Table dropped.

SQL>
SQL>








18.11.Repitition
18.11.1.Repetition Operators
18.11.2.Looking for two consecutive vowels
18.11.3.Writing of the RE with a repeat operator: put in curly brackets {}.
18.11.4.A quantifier {m} matches exactly m repetitions
18.11.5.{m,n} where m,n specifies that the match should occur from m to n times
18.11.6.Three to five consecutive vowels
18.11.7.At least m times with: {m,}