Parse string for A-Z,a-z,0-9 only

Hi all,

Just wondering if anyone has a good function for parsing a string in as3 to remove all characters that are not alphanumeric (and ideally being able to add a few more characters such as _ )

I want to use it to check user input before sending it to PHP (which checks it as well but I would like to have the user side ie flash check it first).

I am sure I could write it by creating an array of the characters I want it limited to and working through each character in the user input and removing those that don’t match; but this seems slow and cumbersome.

Alternatively passing it to PHP and having that use its string functions to check then pass back to flash; but I would rather it done purely on the Flash side.

Thanks for your consideration.