I was just about to suggest that. I have also seen where some companies
show x's for the first 3 groups of numbers then show you the real last 4
digits. Keep in mind I'm a beginner but here's what I came up with for
that:
#!/usr/bin/perl -w
use strict;
my $number = "1111 8578 596 8552";
my @card = split(" ", $number);
for my $a (0..2) {
$card[$a] =~ s/\d/x/g;
}
print @card;
-----Original Message-----
From: Guilherme Pinto [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 2:32 PM
To: 'Fernando'; [EMAIL PROTECTED]
Subject: RE: Regrex substitution!!!
> $number = "1111 8578 596 8552";
> $number =~ s/\d+/x/g;
$number = "1111 8578 596 8552";
$number =~ s/\d/x/g;
Try without the quantifier for the digit class.
> -----Original Message-----
> From: Fernando [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 11, 2001 5:31 PM
> To: [EMAIL PROTECTED]
> Subject: Regrex substitution!!!
>
>
> I have a credit card number that I want to change to email a
> reciept to the customer. This is that I want:
>
> I have this number: e.j. 1111 8578 596 8552
> I want to convert all the number to "x" like that xxxx xxx xxxx
>
> when I use this:
>
> $number = "1111 8578 596 8552";
> $number =~ s/\d+/x/g;
>
> Perl give only one "x" in the result.
>
> If any body can help me please!!!
>