
Laurent_R
Veteran
/ Moderator
Jan 7, 2018, 5:54 AM
Post #6 of 8
(2852 views)
|
OK, one try with some assumptions on your input:
use strict; use warnings; my $input = "war eligible, init =0*DEC0, ev = {1*BIN0,2*DEC3,6*BIN4, & 5*BIN43,6*DEC32, & 5*BIN43,7*DEC32} war wear, init =1*DEC1, ev = { & 1*BIN0,2*DEC3,6*BIN4, & 5*BIN43,6*DEC32, & 5*BIN43,7*DEC32,6*DEC32,6*DEC3, & 8*BIN3,6*DEC34 } "; my @strings = split /\nwar/m, $input; for (@strings) { s/\n\&//g; my $match = $1 if /\{([^}]+?)\}/mg; print "match: $match \n" } This produces the following output:
match: 1*BIN0,2*DEC3,6*BIN4, 5*BIN43,6*DEC32, 5*BIN43,7*DEC32 match: 1*BIN0,2*DEC3,6*BIN4, 5*BIN43,6*DEC32, 5*BIN43,7*DEC32,6*DEC32,6*DEC3, 8*BIN3,6*DEC34 I suppose this is (more or less) what you want.
|