Talend Connect
Virtual Summit
And visit the Customer
& Community Lounge.
May 27-28, wherever you are.

Unable to use a conditional expression with the tReplace component

Talend Version       6.x


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

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 #:
10 of 10
Last update:
‎04-13-2019 12:40 PM
Updated by: