php - Get the content of the href attribute of an a element -


possible duplicate:
grabbing href attribute of element

hello,

i have following html want parse:

<td align="left" nowrap="nowrap"><a href="xxxxxxx"> 

i want save xxxxx on variable. know next nothing of regular expressions. know how using strpos, substr, etc. believe slower using regex.

if (preg_match('!<td align="left" nowrap><a href=".\s+/.+">!', $result, $matches))     echo $matches[1]; else     echo "error!!!"; 

i know previous code atrocity regex expert. have no idea how it. need some tips, not full solution.

here's (not remotely original) tip: don't use regex parse html. use html parser.

see how parse , process html/xml in php?.


Comments