regex - hex class

J

John

Hi

I may have an error elsewhere in my program,
but , for the moment, will the following removed all hex chars 00 to 40?

$x =~ s|[\x00-\x40]||g;

Regards
John
 
S

sln

Hi

I may have an error elsewhere in my program,
but , for the moment, will the following removed all hex chars 00 to 40?

$x =~ s|[\x00-\x40]||g;

Regards
John
"but , for the moment, will the following removed chars: hex 00 to 40?
That should work, have you tried it?
$x =~ s/[\x{00}-\x{40}]//g;

-sln
 
J

John

Hi

I may have an error elsewhere in my program,
but , for the moment, will the following removed all hex chars 00 to 40?

$x =~ s|[\x00-\x40]||g;

Regards
John
"but , for the moment, will the following removed chars: hex 00 to 40?
That should work, have you tried it?
$x =~ s/[\x{00}-\x{40}]//g;

-sln

Hi

It doesn't work so I now know I have a problem somewhere else.

Regards and thanks
John
 
J

John W. Krahn

John said:
I may have an error elsewhere in my program,
but , for the moment, will the following removed all hex chars 00 to 40?

$x =~ s|[\x00-\x40]||g;

$ perl -le'
use Data::Dumper;
$Data::Dumper::Useqq = 1;
my $string = join q//, map chr, 0 .. 127;
print Dumper $string;
$string =~ s|[\x00-\x40]||g;
print Dumper $string;
'
$VAR1 =
"\0\1\2\3\4\5\6\a\b\t\n\13\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\e\34\35\36\37
!\"#\$%&'()*+,-./0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177";

$VAR1 =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177";


Yes, that works.



John
 
J

John

John W. Krahn said:
John said:
I may have an error elsewhere in my program,
but , for the moment, will the following removed all hex chars 00 to 40?

$x =~ s|[\x00-\x40]||g;

$ perl -le'
use Data::Dumper;
$Data::Dumper::Useqq = 1;
my $string = join q//, map chr, 0 .. 127;
print Dumper $string;
$string =~ s|[\x00-\x40]||g;
print Dumper $string;
'
$VAR1 =
"\0\1\2\3\4\5\6\a\b\t\n\13\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\e\34\35\36\37
!\"#\$%&'()*+,-./0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177";

$VAR1 =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177";


Yes, that works.



John


OK. Thanks. It should removed '0A' and I guess it does but it re-appears
later on.
My guess is somewhere later in the propram it is added back.

Regards
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top