Hi, According to Sun, the find() method under matcher does the following:
"Attempts to find the next subsequence of the input sequence that matches the pattern."
So in human this means to me that find() returns true if a string CONTAINS a sequence that matches the regex. However, with my program, it only returns true if the string itself matches the regex. So with the following inputs:
Your first term in the regex looks for U or C at the beginning of the line, if I remember correctly. You will have to go through the regular expression part of the Java Tutorial expecially the bit about "boundary matchees" to check that ^ does mean start of line.
The <> bit moves U away from the start of the line.
Joined: Nov 17, 2003
Good call, the ^ and $ were it. Basically I was saying that all the line should contain is my regex. I removed those chars from my regex and it matches as expected now.
Thanks for the help!
Joined: Oct 13, 2005
Actually, I think the first component matches U or C or nothing.