Det ser ud til, at *
i Oracle 11 og +
mønstre (med intet forud for dem) genererer nul-bredde-matches. Så (*)
og (+)
fanger grupper ()
indeholdende nul-bredde-mønstrene *
eller +
hhv.
Alle disse forespørgsler returnerer en række:
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '*' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '(*)' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '^*' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '^(*)' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '*1' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '+' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '(+)' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '^+' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '^(+)' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '+1' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '^+1' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '+1$' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '^+1$' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '()' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '12', '1(*)2' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '12', '1(+)2' );
Disse forespørgsler returnerer ingen rækker:
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '*2' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '^*$' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', '^+$' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '12', '11(*)2' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '12', '11(+)2' );
Matcher også ethvert mønster mod NULL
eller en streng mod en NULL
mønster vil ikke returnere nogen rækker:
SELECT * FROM DUAL WHERE REGEXP_LIKE( NULL, '*' );
SELECT * FROM DUAL WHERE REGEXP_LIKE( '1', NULL );
Bruger REGEXP_SUBSTR
:
SELECT REGEXP_SUBSTR( '1', '+' ) FROM DUAL;
Udskriver en enkelt række indeholdende NULL
.