in reply to Re: Regular expression to check for invalid file name characters
in thread Regular expression to check for invalid file name characters
Maybe a character class of what is allowed would be a better approach, users can be very inventive :)
sub is_valid_name { $_[0] =~ m{[a-zA-Z0-9_ ]} }
Update: OOps, still learning ..., a negated character class.
Update2: JavaFan is right, this is not the right way to do it.sub is_valid_name { $_[0] !~ m{[^a-zA-Z0-9_ ]} }
Update3: ... and I need my salary and don't want to upset the rest of the world ;)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regular expression to check for invalid file name characters
by JavaFan (Canon) on Feb 22, 2010 at 13:02 UTC |