my $s = s/_*(X+)_*/length($1) . ','/ge; $s =~ s/,$//; [download]
In reply to Re: Replacing string with its length in Regex by bikeNomad in thread Replacing string with its length in Regex by Brovnik