You can always use unicode-regex-range-character-class.pl
space => [\u0009-\u000D\u0020\u0085\u00A0\u1680\u180E\u2000-\u200A\u20
+28-\u2029\u202F\u205F\u3000]
so $ perl -pe " s{\\u(....)}{\\x{$1}}g "
[\u0009-\u000D\u0020\u0085\u00A0\u1680\u180E\u2000-\u200A\u2028-\u2029
+\u202F\u205F\u3000]
[\x{0009}-\x{000D}\x{0020}\x{0085}\x{00A0}\x{1680}\x{180E}\x{2000}-\x{
+200A}\x{2028}-\x{2029}\x{202F}\x{205F}\x{3000}]
Thus #!/usr/bin/perl --
use warnings;use strict;
use Data::Dump;
$_ = qq{\xC2\xA01.00};;
utf8::decode($_);
dd[$_];
s{^[\x{0009}-\x{000D}\x{0020}\x{0085}\x{00A0}\x{1680}\x{180E}\x{2000}-
+\x{200A}\x{2028}-\x{2029}\x{202F}\x{205F}\x{3000}]+}{}g;
dd[$_];
__END__
["\xA01.00"]
["1.00"]
Although, in 5.10 you could probably just use s{^\p{space}+}{}g;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|