in reply to Match alphamumeric and space
That is hard to improve on. You may like to give it a meaningful name and precompile it:
If you want to count tabs and newlines as spaces, you can use the \s character class instead of your space, and add the s qualifier to the regex.my $ungood = qr/[^a-zA-Z1-9 ]/; warn "Bad Text!" if $string =~ $ungood;
It could be worthwhile someday to recast your character class as unicode, something like $ungood = qr/[\P(IsAlnum)\P(IsSpace)]/s; $ungood = qr/[^\p(IsAlnum)\p(IsSpace)]/s; (Oops!).
After Compline,
Zaxo
|
|---|