Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have hit a wall using tExtractRegexFields, namely positive lookahead, which does not appear to be in this list, so it appears I cannot use that component. Let's start simple. How would I use a simple regex to match something from a column in a tFileInputDelimited and cat it to a tLogRow?
If I use
(?<=myvalue:)[0-9]*
on data
blah () ; blah, {} words myvalue:42 more data [] 23
in jEdit or elsewhere, it matches "42". Talend is not giving me a match.
Also, if I attempt to match data inside brackets in Talend I am met with an "Invalid escape sequence.." error. This works elsewhere. Please see screenshots.
If it is known why these are not working any help would be appreciated. As per the OP, if it is known how to use REGEX in a tJavawhatever component, that information would be greatly appreciated.
bump
It works fine with Pattern and Matcher within a tJavaRow component.
I used tRowGenerator to generate one row with your string:
blah () ; blah, {} words myvalue:42 more data [] 23
In the tJavaRow, aside from the input and output row code I used the following code as a very rough example:
Pattern pattern = Pattern.compile("(?<=myvalue:)[0-9]*"); Matcher matcher; if (pattern.matcher(input_row.Test).find()){ System.out.println("Row Matched"); }
else{ System.out.println("Row not Matched"); }
Which gave me the following result when I ran the job:
Hope this helps..!