http://www.perlmonks.org?node_id=457360


in reply to Re: regex to remove all non a-z and spaces
in thread regex to remove all non a-z and spaces

This regex isn't exactly working for me.
$cleaned_search =~ s/[^a-z0-9 ]+//gi;
I keep getting files named "this+is a test.html", "the+farmer saves the day" and "i+hate this stuff.html".

I thought it was the + so I removed it and the regex is still adding a + sign in my string when it wasn't there before. I also can't add any weird characters because it errors out when it tries to create the file. IE: if I used \ it said it failed to open on a closed filehandle or something.

So it seems this regex isn't working at all.