in reply to Re: regular expression
in thread regular expression

I have to show only fist 6 and last 4 digits in between there can be any number of characters

Replies are listed 'Best First'.
Re^3: regular expression
by moritz (Cardinal) on Feb 15, 2012 at 12:56 UTC

      Slight variation so you don't need the length:

      substr($str, 6, -4) =~ s/./X/g;

      Inspiring. Subtracting the sum of the value of the length of the first and last visible digits to establish the variable length of the middle section. ++