in reply to Re: Regex to cange HTML %?? to char(0x??);
in thread Regex to cange HTML %?? to char(0x??);
How about these?
# The above shrunk a bit. $str =~ s/%([0-9A-F][0-9A-F])/chr(hex($1))/ieg; # - or more cryptic $str =~ s/%([0-9A-F][0-9A-F])/sprintf("%1c",hex($1))/ieg;
Can anyone think of something that doesn't use hex?
TGI says moo
Update
Bill's post and Abigail's clever method taken together let us chop off another character or so:
s/%([0-9A-F]{2})/"chr 0x$1"/igee;TGI - Syncretic Cretin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex to cange HTML %?? to char(0x??);
by Abigail (Deacon) on Jun 20, 2001 at 02:31 UTC |