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 romping around the Monastery: (6)
As of 2014-09-21 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (175 votes), past polls