<p>I'm still learning RegEx at the moment, but for the time being could someone help me out with this?  I have a few special requirements for formatting the string:</p>

<ol>
<li>No directories.  JUST the file name.</li>
<li>File name needs to be all lowercase.</li>
<li>Whitespaces need to be replaced with underscores.</li>
</ol>

<p>Shouldn't be hard, but I'm pressed for time and I'm not sure on the 'correct' way to ensure a valid file name (namely I forget which characters were supposed to be invalid for file names).</p>

If you're in a super-quick hurry, you can usually find acceptable regular expressions in the library at
http://regexlib.com/
.
Edit to say:
Here's one that might work for you
:
```
```
([0-9a-z_-]+[\.][0-9a-z_-]{1,3})$
```
```