Teradata 14.0 - regex_replace unexpected result

Database

Teradata 14.0 - regex_replace unexpected result

 I tested TD14.0 regex this was an unexpected result:

 CREATE MULTISET VOLATILE TABLE a ( e VARCHAR(10000) ) ON COMMIT PRESERVE ROWS;

 INSERT INTO a SEL '(((((y1(y1 - y1) y1 y1)) y1 y1) y1 (((y1(y1 - y1) y1 y1)) y1 y1 y1)) y1 ((((y1(y1 - y1) y1 y1) y1 (y1(y1 - y1) y1 y1)) y1 y1) y1 (((y1(y1 - y1) y1 y1) y1 (y1(y1 - y1) y1 y1)) y1 y1 y1))) y1 ((((y1(y1 - y1) y1 y1) y1 (y1(y1 - y1) y1 y1) y1 (y1(y1 - y1) y1 y1) y1 (y1(y1 - y1) y1 y1)) y1 y1) y1 (((y1(y1 - y1) y1 y1) y1 (y1(y1 - y1) y1 y1) y1 (y1(y1 - y1) y1 y1) y1 (y1(y1 - y1) y1 y1)) y1 y1 y1))';

 SEL

 REGEXP_REPLACE(

     (SEL TRIM(e) FROM a),

     '[^(]*',

     '', 1, 0, 'i')

 ,REGEXP_REPLACE(

     (SEL TRIM(e) FROM a),

     '[^)]*',

     '', 1, 0, 'i'

     )

 --//first value -> correct

 ((((((((((((((((((((((((((((((((((((((((((((

--//second value ->  --//why ? Should be like above, that is only ")" characters.

 )))))))))))))))))))))))))))))))))))))))) y1 y1)) y1 y1 y1))

 For the record, both expressions return correct value if Perl regex are used.

 Did anybody encounterd something similar or can explain why ?

 Kind regards.

2 REPLIES
Junior Contributor

Re: Teradata 14.0 - regex_replace unexpected result

You should open an incident with Teradata support, this is definitely a wrong result.

Re: Teradata 14.0 - regex_replace unexpected result

Thank you Dieter, will do so.