in reply to regex assistance
Your array has only one element. I think meant a string as input! Must have book for Regex challenges: Mastering Regular Expressions UPDATE: Other monks have already posted answers while I was drafting this!use strict; use warnings; my $string ="GAP_SPAN09 - GAP SPAN base (Scratch Testing [TSMC11] : ts +mc11_wld(sxfatd12j)) GAP_SPAN03 - GAP SPAN base (DFD E2E Testing [TSP +AN04: tspan04-dfdint-wld(sxfamd6f)) POS_WLI02 - POS_WLI02 Web Logic I +ntegrator"; my @array; while ($string =~ m/(\w+\s?)-/g) { push (@array, $1); } print join("\t", @array);
|
|---|