Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Asterisk versus + in this regular expression

2776946Apr 16 2016 — edited Apr 18 2016

image.png

now with asterisk: (see the highlighted part in code below)

image.png

now asterisk is to match 0 or more occurrences - so I'm assuming the dashes between the characters (i.e. -A-n-d-) signifies a 0 occurrence. Am I correct in assuming this?

Also why are *&% and $@($*@' both replaced with double in this case compared to 1 dash when we use a plus operator. Is this another 0 occurrence case?

Here's the code if anyone needs it

SELECT REGEXP_REPLACE('And then he said *&% so I replied with $@($*@',

'[!@#$%^&*()]*','-') PRIME_TIME

FROM DUAL;

This post has been answered by mathguy on Apr 16 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 16 2016
Added on Apr 16 2016
17 comments
3,465 views