Pattern Matching in Java
Posted on 2001-08-20
I want to make a function of signature like below
"private boolean funcPat(File f1, String pattern)"
in which I'll pass file like C:\myfile.java or C:\myfile.exe or may be anything, alongwith pattern.
pattern may be any regular expresion like "m*.e*". The function will match the pattern with filename and its extention and will return true or false.
Say File = myfile.java .
if pattern = myf*.ja* return true.
if pattern = myf*.exe return false.
if pattern = fyf*.ja* return false.
if pattern = *yf*.* return true.
if anybody knows how can it be done in Java pls let me know.