Page 1 of 1

RegEx Engine not working correctly?

Posted: Mon Jun 01, 2009 6:56 pm
by kadunkadunk
Source Text:
PCTFREE 10
INITRANS 1
STORAGE
(
INITIAL 80K
NEXT 1024K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
)
TABLESPACE MCPPD_DATA
NOLOGGING
MONITORING
NOPARALLEL;

Match Pattern:
(PCTFREE.*)(TABLESPACE )([A-Z|_]*)([^;]*;)
Replace Pattern:
$2$3;

Expected Results:
TABLESPACE MCPPD_DATA;

I have the 'S' OPTION on. It is not picking up ([A-Z|_]*)([^;]*;).
Do you think this is a bug?

Re: RegEx Engine not working correctly?

Posted: Mon Jun 01, 2009 9:57 pm
by Abacre
There are a lot of excessive places in your regular expressions.

Try the following simpler expression:
Search for:
PCTFREE.*(TABLESPACE \S+)\s+.*;
Replace with:
$1;

Re: RegEx Engine not working correctly?

Posted: Tue Jun 02, 2009 2:00 pm
by kadunkadunk
Thank you for your help and quick relpy. Your code worked. However, my code should work as well. I tried at least 20 combinations of metacharacters, all of which should have worked. I started out with an expression with only one capturing block, but the regex engine did not like that either. I only used the more basic character classes, i.e. [a-z|_], as a last resort to try and de-bug the regex engine. I still think there is a bug and a ticket should be opened.

Let me know what you think.

Thanks