\s is suppose to match U+00A0 and sometimes does. It's a bug in Perl that cannot be fixed for backwards compatibility reasons. You can indicate you want the fix using feature unicode_strings. In earlier versions of Perl, you can also work around the bug by upgrading the string's internal format.
use strict; use warnings; use feature qw( say ); my $string = chr(160); no feature qw( unicode_strings ); say $string =~ /^\s*$/ ? 1 : 0 ; # 0 use feature qw( unicode_strings ); say $string =~ /^\s*$/ ? 1 : 0; # 1 no feature qw( unicode_strings ); utf8::upgrade($string); say $string =~ /^\s*$/ ? 1 : 0; # 1
In reply to Re: Can I change \s?
by ikegami
in thread Can I change \s?
by pileofrogs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |