|
|
Jacobb123 01-11-2008, 02:38 PM I need to match the "Health" in the following line. I have more lines that I need to match they all follow the same pattern but of course the links change.
<li><a class="subtle" href="/dir/?link=list&sid=396545018">Health</a></li>
oesxyl 01-11-2008, 02:50 PM I need to match the "Health" in the following line. I have more lines that I need to match they all follow the same pattern but of course the links change.
<li><a class="subtle" href="/dir/?link=list&sid=396545018">Health</a></li>
/<a class="[^>]+>([^<]+)/
best regards
arnyinc 01-11-2008, 03:43 PM There is also a strip_tags function which would work:
<?php
$text='<li><a class="subtle" href="/dir/?link=list&sid=396545018">Health</a></li>';
$word=strip_tags($text);
echo $word;
?>
Jacobb123 01-12-2008, 02:54 AM Thanks for the advice. I have another question related to this.
After using the regex and preg_match_all it matches the strings I need but also some that I don't want.
I am trying to scrape category listings from a site. All the categories are listed between <UL></UL> tags I only want to match the lines inside the <UL> tags. Is this possible?
oesxyl 01-12-2008, 07:02 AM Thanks for the advice. I have another question related to this.
After using the regex and preg_match_all it matches the strings I need but also some that I don't want.
I am trying to scrape category listings from a site. All the categories are listed between <UL></UL> tags I only want to match the lines inside the <UL> tags. Is this possible?
/<ul>([^<]+)/m
all this can't help you if don't try to understand how regex work.
best regards
|
|
|
|
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum
vBulletin® v3.8.2, Copyright ©2000-2013, Jelsoft Enterprises Ltd.