Re: regex replace credit card numbers with *



Tad McClellan 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.
>
> an lvalue substr():
>
> substr($cc, 0, -4) =~ tr/0-9/*/;

Ooh, I like! I was trying to think of a good way of doing this with
substr, but I was blanking on remembering the "negative limit" feature
of the function.

Thanks, Tad.

Paul Lalli

.



Relevant Pages