Re: [PHP] Add to regex help

2004-10-19 Thread Silvio Porcellana
Uhm, I guess you are looking for links (following a 'href') in your HTML page, so why 
don't you just do something like:

preg_match_all('/href=[\\']?([^\\'\s]*)[\\']?/i', $url, $matches)
(note the '\s' added inside the bracket that should match the link, as you could have:
a href=pippo.com target=_blank - that is, a link terminated by a white space)
HTH, cheers!
Silvio
Mag wrote:
Hi,
Quite some time back I modified a regex (to the one
below) to work with my script:
if (preg_match_all('/a\s+.*?href=[\\']?([^\\'
]*)[\\']?[^]*.*?\/a/i', $url, $matches))
{
   foreach($matches as $match){$links[] = $match;}
}
Problem is, I dont really know REGEXs properly and
dont remember how I modified it and it completly
ignores the below: 

area shape=rect coords=95,8,242,145
href=2/FIVE.MPG
because its a map and I guess it does not start with
a and does not end with /a
but I need to make sure it catches even the above...
Can someone help me add to the above regex please?
Thanks,
Mag
=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Add to regex help

2004-10-18 Thread Mag
Hi,
Quite some time back I modified a regex (to the one
below) to work with my script:

if (preg_match_all('/a\s+.*?href=[\\']?([^\\'
]*)[\\']?[^]*.*?\/a/i', $url, $matches))
{
   foreach($matches as $match){$links[] = $match;}
}

Problem is, I dont really know REGEXs properly and
dont remember how I modified it and it completly
ignores the below: 

area shape=rect coords=95,8,242,145
href=2/FIVE.MPG

because its a map and I guess it does not start with
a and does not end with /a

but I need to make sure it catches even the above...

Can someone help me add to the above regex please?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php