Re: regex replace credit card numbers with *
- From: Tad McClellan <tadmc@xxxxxxxxxxxxxx>
- Date: Thu, 29 Sep 2005 12:08:38 -0500
Paul Lalli <mritty@xxxxxxxxx> wrote:
>
> A. Sinan Unur wrote:
>> "cldmismgr" <admin@xxxxxxxxxx> wrote in news:1128001319.174650.190970
>> @g47g2000cwa.googlegroups.com:
>>
>> > replace all but the last 4 numbers
>> > in a credit card number with *'s.
>> my $cc = '123456789012345';
>> $cc =~ tr/0123456789/*/;
> Er, the output of that code is a series of 15 *'s. Doesn't seem to be
> what the OP asked for.
So let's fix it with an lvalue substr():
substr($cc, 0, -4) =~ tr/0-9/*/;
--
Tad McClellan SGML consulting
tadmc@xxxxxxxxxxxxxx Perl programming
Fort Worth, Texas
.
- Follow-Ups:
- Re: regex replace credit card numbers with *
- From: Paul Lalli
- Re: regex replace credit card numbers with *
- References:
- regex replace credit card numbers with *
- From: cldmismgr
- Re: regex replace credit card numbers with *
- From: A. Sinan Unur
- regex replace credit card numbers with *
- Prev by Date: Re: How do I install this package using ppm?
- Next by Date: Re: string comparison
- Previous by thread: Re: regex replace credit card numbers with *
- Next by thread: Re: regex replace credit card numbers with *
- Index(es):
Relevant Pages
|