php preg_match pattern to extract a specific information, regex

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-06-13T04:00:37Z Indexed on 2010/06/13 4:02 UTC
Read the original article Hit count: 303

Filed under:
|
|

I need to extract a specific Id from a html document but the problem is that the id must not "be used".

Here is the html content http://pastebin.com/wF2dx8JZ

As you may see there are different html blocks . Some of them contain the "Used" word so I need to extract only the first id which is not used. Basically I can write a simple pattern like : $pattern = "/javascript:tw(.*))/"; preg_match_all($pattern, $content, $matches); $id = $matches[1][0];

However in this case I'm also getting the "ids" which are used so I don't know how to exclude them from the equation . Any idea would be highly appreciated.

© Stack Overflow or respective owner

Related posts about php

Related posts about regex