I have a pattern string with a wild card say X (E.g.: abc*).
Also I have a set of strings which I have to match against the given pattern.
E.g.:
abf - false
abc_fgh - true
abcgafa - true
fgabcafa - false
I tried using regex for the same, it didn't work.
Here is my code
String pattern = "abc*";
String str = "abcdef";
Pattern regex = Pattern.compile(pattern);
return regex.matcher(str).matches();
This returns false
Is there any other way to make this work?
Thanks