[pve-devel] [PATCH v3 storage 2/3] Incorporate wipe_disks from PVE::Ceph::Tools

Dominik Csapak d.csapak at proxmox.com
Thu Apr 16 07:41:54 CEST 2020


wanted to chime in here (since i believe the original comment
about unicode literals came from me)

On 4/15/20 5:02 PM, Thomas Lamprecht wrote:
> albeit I'm not to sure if the unicode stuff is really true, I tried:
> perl -we '"Ⅲ" =~ /\d/ or die "no match"'
> 
> where "Ⅲ" is the roman numeral three (U+2162) and that does not matches,
> but it could be wrong encoding or whatever...

if you use utf symbols in the source, it only works if you
have 'use utf8;'

also the roman numeral three is not considered (afaik) as
part of the 'digits' group (only those that also match \p{Digit} [0])
but '৪' for example (bengali digit four (U+09EA))

if the source comes from outside, you have to have a 'perl string'
with the correct code point,
which happens e.g. when using decode_utf8 on a string with
such a character

so this example matches:

---8<---
use Encode;
my $val = decode_utf8(shift);
if ($val =~ /(\d+/)) {
	print "found $1\n";
}
--->8----

when calling with
perl foo.pl ৪

so to avoid confusion (and probably errors), i proposed always using 
[0-9] instead of \d

0: https://perldoc.perl.org/perlrecharclass.html




More information about the pve-devel mailing list