This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
You'll need to be more specific. Do you want to allow digits in the extension? What about non-alphanumeric characters in the filename? In any case, here's one that allows any non-space character in the base name and any alphanumeric (letter or number) character in the extension:Note that this allows a newline (\n) and other symbol characters for the base name. You may want to limit this a bit to something like
Originally posted by Layne Lund: Did you miss the ^ towards the beginning of your second regex?
No, the first regex excludes space while the second one includes a specific set of characters: a-z A-Z 0-9 - _ , ! ( and ). It all depends on how restrictive JiaPei wants to be with the two parts of the filename. For example, must it match Unix or Windows naming restrictions?
I just stumbled across RegEx Coach the other day. It's a neat interactive way to play with expressions and see how they work. It won't write them for you but it will surely help you understand them. Anybody else have favorite tools in this space?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi