in reply to Re: regex assistance
in thread regex assistance

Apologies the example given should have looked like this
my @array=('GAP_SPAN09 - GAP SPAN base (Scratch Testing [TSMC11] : tsm +c11_wld(sxfatd12j))','GAP_SPAN03 - GAP SPAN base (DFD E2E Testing [TS +PAN04] : tspan04-dfdint-wld(sxfamd6f))','POS_WLI02 - POS_WLI02 Web Lo +gic Int +egrator');
So there are 3 elements. This was purely an example though since there could be upto 20 elements in the original array

Replies are listed 'Best First'.
Re^3: regex assistance
by Utilitarian (Vicar) on Oct 20, 2010 at 13:17 UTC
    Ahh, the question becomes clearer though the logic is largely similar

    use strict; use warnings; my @records=('GAP_SPAN09 - GAP SPAN base (Scratch Testing [TSMC11] : t +smc11_wld(sxfatd12j))', 'GAP_SPAN03 - GAP SPAN base (DFD E2E Testing [TSPAN04] : tspan04-d +fdint-wld(sxfamd6f))', 'POS_WLI02 - POS_WLI02 Web Logic Integrator)'); my @record_ids; for my $record (@records){ $record=~m/^(\S+)(?= - )/g; push @record_ids , $1; } for my $record_id (@record_ids){ print "$record_id\n"; } __END__ GAP_SPAN09 GAP_SPAN03 POS_WLI02
    print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
Re^3: regex assistance
by jwkrahn (Abbot) on Oct 20, 2010 at 18:52 UTC
    my @newarray = map /^(\S+) +- /, @array;