|
Prev: counting the number of characters that were matched in a regular expression
Next: Does Perl use a special hand-made parser, or does it use Yacc or some other pre-packaged tool?
From: Glenn Jackman on 16 Apr 2008 15:42 At 2008-04-16 03:08PM, "PugetSoundSylvia(a)gmail.com" wrote: > In a string, I need to replace all instances of 15 or 16 number > characters with the 11 or 12 "x" characters, then the last 4 digits of > the 15 or 16 number characters. The chunk of number characters may > appear numerous times in the string. You want s/(\d{11,12})(\d{4})/"x" x length($1) . $2/eg Note the 'e' modifier -- Glenn Jackman "If there is anything the nonconformist hates worse than a conformist, it's another nonconformist who doesn't conform to the prevailing standard of nonconformity." -- Bill Vaughan |