in reply to Regex for weird characters
This is equivalent to checking that no character has an integer value less than or equal to 31 (1f hex), or greater than or equal to 127 (7f hex):print "funny" if ($c =~ /[[:^ascii:][:cntrl:]]/);
print "funny" if ($c =~ /[\x00-\x1f\x7f-\xff]/s);
See perlre(1) for more details.
Both of these solutions disallow newlines and tabs; you can allow them with the [:isspace:] character class.
|
|---|