Matcher.matches() tries to match the entire string to the pattern. Your pattern will match against any number of 'v's, but it won't match anything that isn't a 'v'.
Perhaps you intended Pattern.compile("v.*") ?
Dinkar Chaturvedi
Ranch Hand
Joined: Mar 27, 2007
Posts: 31
posted
0
Hmm!! That is interesting.
What if I want to find if the pattern v* occurs in the string vyadav?
Thanks a lot!! I didnt realize that there are other methods as I am used to the functionality with find() method instead of looking for the entire string as a match.