Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am using a regex,
(?<=myvalue:)[0-9]*
to match a number after "myvalue:", the data looks like "myvalue:42", and I need the 42. This works in most regex engines, but I'm having trouble getting it to match in Talend. Please advise.
Why not substring?
String s = "myvalue:42"; System.out.println(s.substring(s.indexOf(":") + 1));
Thank you for the reply; love the avatar.
So you are suggesting I use something like
(myvalue:[0-9]*)
then use a tJavasomething to substring it?
bump
This one should also work:
row1.myField.replaceAll("^.*:", "")
and if you expect the result as an Integer:
Integer.parseInt(row1.myField.replaceAll("^.*:", ""))
This may appear in a tMap expression or in any place where you're able to enter a piece of Java code.
Hope this helps.
Hi @TRF, thank you for the suggestion. I will test and get back to you.
@TRFwrote:
This one should also work:
row1.myField.replaceAll("^.*:", "")and if you expect the result as an Integer:
Integer.parseInt(row1.myField.replaceAll("^.*:", ""))This may appear in a tMap expression or in any place where you're able to enter a piece of Java code.
Hope this helps.