Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 chilling in the Monastery: (6)
As of 2014-12-20 15:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (96 votes), past polls