in reply to regular expression help
The first regex handles comment lines, the second one greps all occurances of either an X,Y or Z followed optionally by a negative or positive sign followed by a combination of digits and dot.my @results; while (<>) { if (/^N\d+\s+\*(.*)/) { push @results, "!$1"; } else { push @results, /[XYZ]([-+]*[\d\.]+)/g; } } print join ' ',@results;
|
|---|