|Unable to use a conditional expression with the tReplace component.|
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|