This content has been marked as final. Show 4 replies
There's no need for Regex, and no need to reinvent a wheel that already exists. You can use javax.swing.filechooser.FileNameExtensionFilter and test the value returned from accept(...)
edit And if I'd seen that you don't bother to return to most of the threads you start, I wouldn't have bothered to respond to this one.
Edited by: Darryl Burke
Darryl , I can't use Swing in my application. So I need to use a regex. This regex will be in a configuration page in my application where the user(client) can modify it to notify the filetypes or file names that they want to ignore from processing. So once my application receives a file, it will get this regex and do a compare with the current file to check if it matches the pattern. If it matches, I should ignore the file. The current regex that I have is
Do you think if I am missing something here?. for some reason this doesn't work for me.
You do not need to use Swing. Try implementing: java.io.FilenameFilter
878059 wrote:Does this mean "I can't use GUI components" or "I can't use any classes in the javax.swing hierarchy"?
Darryl , I can't use Swing in my application.
If it's the former (which would be the most reasonable interpretation in real life) then there's nothing stopping you from using javax.swing.filechooser.FileNameExtensionFilter.