in reply to Can I change the definition of '\s'?
I do not know if you can change the '\s' but you can define your own character property. An example from Programming Perl is
sub InKana{ return <<'END'; +utf8::InHiragana +utf8::InKatakana END }
so you should be able to do this:
sub mySpace{ return <<'END'; +utf8::IsSpace 00A0 00A0 #is this the hexadecimal for your space? END }
This sub must also be defined in the package that needs the property. It can be imported from another module.
Then your regexs could use /\p{MySpace}/ to check. And changing the definition can be done in one location.
For further information Programming Perl, 3rd Edition, page 173. Online, more information about character classes can be found at the online version of perlretut.
I hope this helps.
the_Don
...making offers others can't rufuse.
UPDATE: Changed 4th edition to 3rd edition. Too many books at my desk, I'm sorry.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Can I change the definition of '\s'?
by davorg (Chancellor) on Sep 11, 2002 at 19:12 UTC |