Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: regular expression

by frozenwithjoy (Curate)
on Jan 07, 2013 at 09:38 UTC ( #1011995=note: print w/ replies, xml ) Need Help??

in reply to regular expression

You almost have it right. If I change $kb_lay_img_url=$&; to $kb_lay_img_url=$1;, it works for me. (see: Special Variables)

EDIT: Here, I've made this change (and added Anon's suggestion, which makes the regex safer/better):

#!/usr/bin/env perl use strict; use warnings; use feature 'say'; my $line = "</div><div class='ClipPicture'><a href=' +yboardKeys/Cart/Acer/A_Series/A110/A8A'><img alt='Clip Style Pic' src +='' width='65 +9' height='135'/></a></div><div class='RadioButtonContainerClipStyle' +>"; if ($line=~ /<img .* src='([^']+)'.*\/><\/a>/) { print "got2\n"; my $kb_lay_img_url = $1; say $kb_lay_img_url; } __END__ got2

Comment on Re: regular expression
Select or Download Code
Replies are listed 'Best First'.
Re^2: SOLVED:regular expression
by ansh batra (Friar) on Jan 07, 2013 at 09:51 UTC
    thanks. :)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2015-11-30 13:37 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (771 votes), past polls