Java expression for Pentaho Kettle

3.2k Views Asked by At

I m in a precarious situation. I am looking for a 'JAVA EXPRESSION' for replacing a defined 'place-holder' in kettle.

My incoming string A is

<consumers>
 ?place-holder?
</consumers>

My incoming string Y is

<consumer>
   <info>X</info> 
 </consumer> 

After substitution the final output must be

<consumers>
   <consumer>
     <info>X</info>
   </consumer>  
</consumers>

Basically I am substituting ?place-holder? in 'String A' with 'String B'.

Actually the data's volume is extremely high and hence 'javascript', 'calculator' & 'replace in string' and all other options that I have tried is pathetic in performance.

I have read that 'Java expressions' are high in performance. Somehow, I am not able to come up with the expression.

Any help!

1

There are 1 best solutions below

2
On

Try it out. Self explained picture below

enter image description here

Don't forget to check with java doc to string what expression does actually.

Replaces each substring of this string that matches the