In this example, this tJavaRow component, labelled
validate, will be used to execute a piece Java
code to check whether the character string of each incoming row pertains to
an email address, and then display the validation result.
setSettings {
CODE : "String email = input_row.email;
Perl5Matcher matcher = new Perl5Matcher();
Perl5Compiler compiler = new Perl5Compiler();
Pattern pattern = compiler.compile(\"^[\\\\w_.-]+@[\\\\w_.-]+\\\\.[\\\\w]+$\");
if (!matcher.matches(email, pattern)) {
System.out.println(\"invalid : \" + email);
}
else
System.out.println(\"valid : \" + email);",
LABEL : "validate"
}