in reply to regular expression help
-Markmy $string = ''; # output string open FILE, "<file.txt" or die "Could not open file.txt: $!"; while (<FILE>) { chomp; s/^N\d+ //; # strip line numbers if (/^\*/) { # comment s/^\*/!/; $string .= $_; } else { # other while ($_ =~ /[x-z]/([\d.+-]+)/ig) { $string .= " $1"; } } } print $string;
|
|---|