Unable to use a conditional expression with the tReplace component

Talend Version       6.x

Summary

Unable to use a conditional expression with the tReplace component.
Additional Versions  
Product Talend Studio
Component tReplace
Problem Description

When using a conditional expression in a tReplace component, the Job fails with the following error:

Exception in component tReplace_1
java.util.regex.PatternSyntaxException: Unknown inline modifier near index 7
(a)?b(?(1)c|d)

Here the regular expression part ?(1)c|d is called a conditional expression.

 

Talend 6.x uses Java 1.8, but Java 1.8 doesn't support conditional expressions (for details, see this page http://www.rexegg.com/regex-conditionals.html#engines, where Java is not listed as a supported environment for conditional expressions).

Problem root cause This is a limitation from Java 1.8 where conditional expressions do not work.
Solution or Workaround

Since Talend 6.x uses Java 1.8, you are advised not to use conditional expressions in a tReplace component. Use the attached Java executable to test the regular expression in Java 1.8 using the following syntax:

java MySimplePatternMatch "regex" "string"
JIRA ticket number  
Version history
Revision #:
6 of 6
Last update:
‎11-17-2017 02:56 PM
Updated by: