http://qs321.pair.com?node_id=122591


in reply to RegExp help

So near :-)

The other comments above are of course correct, but the insertion of a critical '?' (to prevent greedy matching) also seems to work:

$line="some text \(\)\xA1 file.txt"; if ($line =~ /(.+?)\s*\(\)\xA1\s*(.+\.txt)/) { $file = $1; # $file =~ s/\s*$//; print ("<a href=\"$2\">$file</a><br>\n"); }
Hope this helps,

Tim