regular expression matching does not work
It seems either something's fishy with the Java regular expression implementation or my understanding of it.
If I match "een" against "dit is een test" using the unix grep utility or using the perl scripting language, I get a match as "een" is part of "dit is een test".
If I try to match these in Java, it doesn't! It seems I need to add ".*" to the beginning and the end of the matching-pattern. That is odd as I did not put a ^ in front or a $ behind my pattern.
Now my question is: how do I get the normal regular expression behaviour in Java? (like grep/sed/awk and also perl somewhat does)
public static void main(String  args)
String input = "dit is een test";
String pattern1 = "een";
String pattern2 = ".*een.*";
System.out.println("pattern 1 matches: " + (input.matches(pattern1)));
System.out.println("pattern 2 matches: " + (input.matches(pattern2)));