in reply to Splitting string using two overlapping patterns
update$line = 'Iteration {Applied Field} {Total Energy} Mx'; while($line){ $line =~m/\w+|{\w+\s+\w+}/; $line = $'; print $&,"\n"; } -----OUTPUT----- Iteration {Applied Field} {Total Energy} Mx
update$line = 'Iteration {Applied Field} {Total Energy} Mx '; print "$1\n" while $line=~s/(\w+\s+\w+|\w+)[}|\s+|\s+{]//; Iteration Applied Field Total Energy Mx
$line = 'Iteration {Applied Field} A {Total Energy} Mx F G {Third + test line}'; print "$&\n" while $line=~s/(?<={)[\w\s]+(?=})|\w+//; Iteration Applied Field A Total Energy Mx F G Third test line
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Splitting string using two overlapping patterns
by AnomalousMonk (Archbishop) on Oct 24, 2013 at 21:28 UTC | |
by Lennotoecom (Pilgrim) on Oct 24, 2013 at 21:32 UTC |