in reply to Match and extract three characters from the middle of a string

Hi svnipp,
If you want to extract D78 like format text you may try this,
$inq = "23D78000"; ($junk, $emc_device, $junk1) = ($inq =~ /^(.*)(\w{3})(\w{3})$/); print "Result: [$junk], [$emc_device], [$junk1]"; #Result: [23], [D78], [000]
Regards,
perlsen
  • Comment on Re: Match and extract three characters from the middle of a string
  • Download Code