Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: RegExp help

by tfrayner (Curate)
on Nov 01, 2001 at 20:50 UTC ( #122591=note: print w/ replies, xml ) Need Help??


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


Comment on Re: RegExp help
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://122591]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2014-10-20 10:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (75 votes), past polls