Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > regex - hex class

Reply
Thread Tools

regex - hex class

 
 
John
Guest
Posts: n/a
 
      10-07-2009
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



 
Reply With Quote
 
 
 
 
sln@netherlands.com
Guest
Posts: n/a
 
      10-07-2009
On Wed, 7 Oct 2009 14:38:09 +0100, "John" <(E-Mail Removed)> wrote:

>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
 
Reply With Quote
 
 
 
 
John
Guest
Posts: n/a
 
      10-07-2009

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Wed, 7 Oct 2009 14:38:09 +0100, "John" <(E-Mail Removed)> wrote:
>
>>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


 
Reply With Quote
 
John W. Krahn
Guest
Posts: n/a
 
      10-07-2009
John wrote:
>
> 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:umper;
$Data:umper::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\2 4\25\26\27\30\31\32\e\34\35\36\37
!\"#\$%&'()*+,-./0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177";

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


Yes, that works.



John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway
 
Reply With Quote
 
John
Guest
Posts: n/a
 
      10-08-2009

"John W. Krahn" <(E-Mail Removed)> wrote in message
news:iE7zm.225471$(E-Mail Removed)...
> John wrote:
>>
>> 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:umper;
> $Data:umper::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\2 4\25\26\27\30\31\32\e\34\35\36\37
> !\"#\$%&'()*+,-./0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177";
>
> $VAR1 =
> "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177";
>
>
> Yes, that works.
>
>
>
> John
> --
> The programmer is fighting against the two most
> destructive forces in the universe: entropy and
> human stupidity. -- Damian Conway



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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How make regex that means "contains regex#1 but NOT regex#2" ?? seberino@spawar.navy.mil Python 3 07-01-2008 03:06 PM
hex string to hex value tim Python 8 11-23-2005 06:27 PM
Hex Color Codes - Hex 6 <=> Hex 3 lucanos@gmail.com HTML 10 08-18-2005 11:21 PM
hex value in string back to real hex value jack Python 4 09-08-2004 07:11 AM
hex(-5) => Futurewarning: ugh, can't we have a better hex than '-'[:n<0]+hex(abs(n)) ?? Bengt Richter Python 6 08-19-2003 07:33 AM



Advertisments