It return false instead of true
How to match "FileNew" in "FileNewABC" which is a value from f_var and return true?
newfilename = Patte开发者_运维百科rn.compile("FileNew").matcher(f_var).matches();
It always return false.
You need to use find
or it will try and match entire input to the pattern.
The matches method attempts to match the entire input sequence against the pattern.
The lookingAt method attempts to match the input sequence, starting at the beginning, against the pattern.
The find method scans the input sequence looking for the next subsequence that matches the pattern.
精彩评论