fardeen786
asked on
urgent help for pattern matching
hi guys,
i need to get everything which is between
</big> tag and <font color=746884> tag in a webpage and then remove html tags so that i can get text between these two tags in the webpage.
thanks
i need to get everything which is between
</big> tag and <font color=746884> tag in a webpage and then remove html tags so that i can get text between these two tags in the webpage.
thanks
ASKER
hi tom,
i have tried this and its not capturing anything
its actually i have it like this
my $res = $ua->request(HTTP::Request->new(GET => $url));
my $content = $res->content;
and iam using ur command
if ($content=m|</big\s*>(.*?) <font\b[^> ]*\scolor\ s*=\s*\"?\ #?746884|) {
print $1;
}
i dont know mate is anything wrong with my way iam doing it or should not i take $content directly
cheers
i have tried this and its not capturing anything
its actually i have it like this
my $res = $ua->request(HTTP::Request->new(GET => $url));
my $content = $res->content;
and iam using ur command
if ($content=m|</big\s*>(.*?)
print $1;
}
i dont know mate is anything wrong with my way iam doing it or should not i take $content directly
cheers
ASKER
hi guys and tom,
would anyone would b able to plz help on this
many thanks
would anyone would b able to plz help on this
many thanks
if($string=~/<\/big>([\S+| \s+]+)<fon t[\S+|\s+] +>/i){
$content=$1;
}
This works, I tested it, but depending on how your reading your stream you may need to add a switch to read multiple lines... thats all.
It strips your tags and leaves the inbetween content to $content
Hope this helps..
-Jacy-
$content=$1;
}
This works, I tested it, but depending on how your reading your stream you may need to add a switch to read multiple lines... thats all.
It strips your tags and leaves the inbetween content to $content
Hope this helps..
-Jacy-
Try adding "s" flag to the regexp:
#!/usr/bin/perl
# read stdin into $_
undef $/;
$_ = <>;
if (m|</big\s*>(.*?)<font\b[^ >]*\scolor \s*=\s*\"? \#?746884| s) {
print $1;
}
#!/usr/bin/perl
# read stdin into $_
undef $/;
$_ = <>;
if (m|</big\s*>(.*?)<font\b[^
print $1;
}
Try adding "s" flag to the regexp:
#!/usr/bin/perl
# read stdin into $_
undef $/;
$_ = <>;
if (m|</big\s*>(.*?)<font\b[^ >]*\scolor \s*=\s*\"? \#?746884| s) {
print $1;
}
#!/usr/bin/perl
# read stdin into $_
undef $/;
$_ = <>;
if (m|</big\s*>(.*?)<font\b[^
print $1;
}
/<\/big>(.*?)<font color\=746884>/s
ASKER
hi ,
thanks to all for all the lovely answers you have given me.
iam able to capture using all of urs coding but iam able able to capture only one occurence
i have in my webpage 5 texts betweeen </big> and <font color=746884> tag
using this codes iam able to capture only one occurence
i have tried putting modifier g with s like evrywhere in the matching iam using g and s together still iam not able to capture other 4 occurences.
can anybody help please
thanks a lot again,
cheers
thanks to all for all the lovely answers you have given me.
iam able to capture using all of urs coding but iam able able to capture only one occurence
i have in my webpage 5 texts betweeen </big> and <font color=746884> tag
using this codes iam able to capture only one occurence
i have tried putting modifier g with s like evrywhere in the matching iam using g and s together still iam not able to capture other 4 occurences.
can anybody help please
thanks a lot again,
cheers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi,
thanks tom it really worked! thanks a lot mate!
what about the other question mate!
if u could help me on that i would be grateful
regards and best wishes
fardeen
thanks tom it really worked! thanks a lot mate!
what about the other question mate!
if u could help me on that i would be grateful
regards and best wishes
fardeen
ASKER
thanks mate
#!/usr/bin/perl
# read stdin into $_
undef $/;
$_ = <>;
if (m|</big\s*>(.*?)<font\b[^
print $1;
}