Title |
Test
Find
Pattern Title
|
Expression |
(?<HTML><a[^>]*href\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>(?<Title>[^<]+|.*?)?</a\s*>) |
Description |
Powerful href extractor for HTML Element A.
Groups extracted result separately that you can easily use HTML Element, URI or its title.
These may be useful to:
(?<HTML><area[^>]*href\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>)
(?<HTML><form[^>]*action\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>)
(?<HTML><frame[^>]*scr\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>)
(?<HTML><iframe[^>]*scr\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>)
(?<HTML><link[^>]*href\s*=\s*[\"\']?(?<HRef>[^"'>\s]*)[\"\']?[^>]*>) |
Matches |
<a href='http://www.regexlib.com'>Text</a> | <a href="...'>Text</a> | & |
Non-Matches |
all other html tags |
Author |
Rating:
Not yet rated.
Aivar Holyfield
|
Source |
|
Your Rating |
|
Title: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (?< at offset 16
Name: Newbie Guy that follow ertain suggestion from CARLOS
Date: 10/10/2008 8:05:25 PM
Comment:
ok, the error is:
preg_match() [function.preg-match]: Compilation failed: unrecognized character after (?< at offset 16
on helper.php file from mod_rokmininews for joomla
ibelieve that this commnd incompatible with PHP 5+
the full wrong line is line is:
preg_match( "'src=(?:\"|\')?(?<imgSrc>[^>]*[^/].(?:jpg|bmp|gif|png))(?:\"|\')?'", $text, $matches );
the sugeston of roberto is:
Instead of "[^>]*" use ".*?"
do not have this expecific on the line, soh i do this and work!
OK LINE COMMAND:
preg_match( "'src=(.*?:\"|\')*?(.*?<imgSrc>[^<]*[^/].(.*?:jpg|bmp|gif|png))(.*?:\"|\')?'", $text, $matches );
look the suggestion .* is used in all ? of commandline
VISIT MY WEBSITE:
http://www.888brazil.tk
Title: it is wrong
Name: tester
Date: 12/18/2005 9:44:00 AM
Comment:
this don't match next next HTML Element A:
<a style="color:red" href="testLink"> linkText </a>
Title: Solved my own problem
Name: Chris
Date: 7/8/2005 7:08:15 PM
Comment:
apparently this site uses the .net framwork... here's the above regex ready to be used in a PHP preg_match_all() context.
-(?P<HTML><a.*?href\s*=\s*[\"\']?(?P<HRef>[^"'>\s]*)[\"\']?.*?>(?P<Title>[^<]+|.*?)?</a\s*>)-
Title: Similar Problem
Name: Chris
Date: 7/8/2005 6:40:01 PM
Comment:
I'm having the same problems as Leo... this regex does exactly what I want it to (in the test area of this site), but then in php 5 using preg_match_all I get the error:
[error] PHP Warning: preg_match_all() [<a href='function.preg-match-all'>function.preg-match-all</a>]: Compilation failed: unrecognized character after (?< at offset 33 in /Users/jchris/Sites/tanager.php on line 21
this is the "H"
is there another regex library I can get for php that will work here?
thanks!
Title: Doesn't work...
Name: Leo
Date: 3/28/2005 10:50:35 AM
Comment:
Hello,
I tried this regex with "The Regex Coach" and it displays the following error: "Character 'H' may not follow '(?<' at position 3".
I like this regex as I tested it on this Site but I don't know how to translate it into perl regex syntax...
regards, Leo
Title: Replace [^>]*
Name: Carlos R. L. Rodrigues
Date: 1/27/2005 11:56:23 AM
Comment:
Instead of "[^>]*" use ".*?"
<a title="lala >>> coco" ...