Welcome Guest, Not a member yet? Register   Sign In
regular expression help
#3

[eluser]Flayra[/eluser]
To get link, title and description try something like this:
Code:
$pattern = "/<a href=\"(.*?)\".*?&gt;(.*?)</a>.*?<p.*?&gt;(.*?)</font>/i";
$html = str_replace("\r\n","", $html);
preg_match_all($pattern, $html, $matches);
print_r($matches);
I'm a bit rusty, so I couldn't remember how to make it multi-line (since . won't accept linebreaks) so I just removed all the line-endings and made all expressions non-greedy.

It should work, but I have only tested it on text in the e editor.


Messages In This Thread
regular expression help - by El Forum - 06-26-2007, 02:41 PM
regular expression help - by El Forum - 06-27-2007, 01:17 AM
regular expression help - by El Forum - 06-27-2007, 06:23 AM
regular expression help - by El Forum - 06-27-2007, 09:21 AM
regular expression help - by El Forum - 06-27-2007, 10:42 AM
regular expression help - by El Forum - 06-27-2007, 11:19 AM
regular expression help - by El Forum - 07-10-2007, 04:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB