^ and $ to make sure it matches from beginning to end, and \Q and \E to make sure it puts a \ in front of non letters chars... If it returns true, you are all good$foo = join '', @{$chars}; $string =~ /^[\Q$foo\E]+$/;
and fail if that matches, would probably be faster since it stops as soon as it finds a character you don't want$string =~ /[^\Q$foo\E]/;
In reply to Re: Some sexy regex
by suaveant
in thread Some sexy regex
by Martin A
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |