The \D switch takes out everything that IS a number. Was the original
question not that this person wanted to take out everything was IS NOT a
number?
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Toby Stuart
Sent: Wednesday, August 15, 2001 11:52 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Regular expresions
i think the /D switch is best...
$str = 'YD*&h9dhiudhc9s9123abc&&%$&()_#';
print $str, "\n";
$str =~ s/\D//g;
print $str, "\n";
> -----Original Message-----
> From: Steve Howard [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, August 16, 2001 2:46 PM
> To: Steve Howard; Mauricio Lairet P.;
> [EMAIL PROTECTED]
> Subject: RE: Regular expresions
>
> oops, my explanation wasn't right (that's what happens this late at
> night).
>
> Your substitution I ref'd substitutes A, Z through a, and z, not what I
> said. The substitute I gave still gets letters out, but not special
> characters, Someone else gave the right answer.
>
> Steve H.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Steve Howard
> Sent: Wednesday, August 15, 2001 11:37 PM
> To: Mauricio Lairet P.; [EMAIL PROTECTED]
> Subject: RE: Regular expresions
>
>
> This is not doing what you think:
>
> $expression=~ s/[AZ-az]//g
>
> Try this instead:
> $expression=~ s/a-z//gi;
>
> The i makes it case insensitive. What you had was substituting everything
> from AZ through az, but not single a through z
>
> Steve H.
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Mauricio Lairet P.
> Sent: Wednesday, August 15, 2001 11:19 PM
> To: [EMAIL PROTECTED]
> Subject: Regular expresions
>
>
> Hi!
>
> I need to get rid of any character that is not a number in a $variable.
> How
> do I do that?
>
> I tried
>
> $expression=~ s/[AZ-az]//g;
> $expression=~ s/\?//g;
> $expression=~ s/\\//g;
> $expression=~ s/\///g;
> $expression=~ s/\.//g;
>
> but I know I'm missing a lot of characters, so Is there a way to make this
> simplier? I mean, in just one line? and just leave the numbers?
>
> Thank you in advance,
> Mauricio Lairet P.
>
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]