I guess regular expressions are just not my thing.
To give some quick background, I am writing an installer using IzPack (great open-source product). Our requirements for the installer entail making sure that some of the paths/directories selected by the user for various inputs do not have spaces (but will accept all other normal path characters). I can accomplish this using IzPack's built-in regular expression validator, but I can't seem to nail the reg ex. I've been trying online resources and my own Java program to test, fix, test again, etc...
My understanding of regular expressions is not great; I understand the basics (start and ending of pattern, etc.). I know that /s should be used as the pattern for finding whitespace.
For anyone willing to spend a few minutes to show me where I have gone wrong, again, I am trying to determine whether or not the test string matches/works with a regular expression that will allow basically all characters *minus* whitespace. This is solely to avoid a potential issue with Windows in which the installed application basically hates any space in the directory/path (pretty common for older Windows apps).
Here are some examples of what I have tried for the reg ex:
^[a-zA-Z0-9\w]*\s$ Comment: \w should allow all characters, no?
And here are some test strings that should or should not work:
Bad: C:\Program Files\My Program\
Bad: C:\Program Files\JavaSoft\Java 1.6\