in reply to change [A-Z] to U, [a-z] to L with one regex?
use Unicode::UCD qw(charinfo); my %category_map = ( Lu => 'U', # letter, upper Ll => 'L', # letter, lower ); my $r = 'SomEThingWithMIXEDRegiSter'; $r =~ s { (.) # capture the character } { $category_map{ charinfo(ord $1)->{category} } }egmsx; # ULLUULLLLULLLUUUUUULLLULLL
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: change [A-Z] to U, [a-z] to L with one regex?
by ikegami (Patriarch) on Mar 20, 2013 at 07:00 UTC | |
|
Re^2: change [A-Z] to U, [a-z] to L with one regex?
by LanX (Saint) on Mar 20, 2013 at 01:20 UTC | |
by ikegami (Patriarch) on Mar 20, 2013 at 06:58 UTC |