Regex ^$ doesn't match empty string

Dear KNIMErs,

 

My regex ^$ (in Row filter) doesn't match an empty string as expected - I know it's an empty string because Java snippet

 

if ($Column 0$=="") {
 return null;
} else {
 return $Column 0$;
}

 

followed by missing value filter node *does* work. Am I missing something?

 

Thanks!

E

This is due to a strange (if not wrong) behavior of Java regular expression in multline mode. We will have a look how we can work around this issue.

I see, thanks.

 

FWIW, odd Java implementations also affect the whitespace character:

 

http://stackoverflow.com/questions/4731055/whitespace-matching-regex-java

 

Poster tchrist seems to offer a solution approach which may interest / help you -- I haven't looked at it in detail, though.
 
Cheers
E

I was struggling with the Java node and matching to e.g. a "dot" at the end of the string. I tried "\.$", ".$", ".\b", "\.\b" I think. For matching to the "dot", the escape character is not needed, which suggests the meta characters are not treated properly.

 

I think in Java Snippet node the following the code: "\\.$". (Note the \\ becuase of the String escaping.)

Thanks, the escaping is something that escaped my attention. :-) Will try.

 

E