pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:
Is it possible to change what '\s' means? It's not matching the non-breaking-space (chr(160)) that I found in this file I have to parse and I'd like it to.
I know, I could just edit my regex to say [chr(160)\s] or something like that, but that's not as fun. And it wouldn't change the behavior of any regexen I didn't manually edit, like ones in someone else's module, for instance.
Said another way, I'd like
my $string = ' '.chr(160).' '; if ( $string =~ /^\s*$/ ) { print "Happy Happy!"; }
... to print "Happy Happy!"
Thanks!
--Pileofrogs
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Can I change \s?
by ikegami (Patriarch) on Oct 28, 2011 at 21:57 UTC | |
by JavaFan (Canon) on Oct 28, 2011 at 23:17 UTC | |
Re: Can I change \s?
by JavaFan (Canon) on Oct 28, 2011 at 21:27 UTC | |
Re: Can I change \s?
by runrig (Abbot) on Oct 28, 2011 at 20:55 UTC | |
by CountZero (Bishop) on Oct 28, 2011 at 21:51 UTC |