Search for H1 Tag



I am a real php newb :)

I want to be able to add some php to my pages to allow me to find the href attribute for a

tag above the php.

Does anyone know how I could achieve this?




tags don't have href attributes ;) I think this is pattern matching, and regex would be first-choice.


I have no idea what you are talking about so I will give you more detail.

I want a php file to be able to find the href in the following

<h1><p class="underheading"><a href="">5 reasons firefox is a better browser</a>



Okay, first of all, get some knowledge on HTML, PHP, the difference between tags and attributes. Then learn regex, what it is, what it does and how you could put it to good use. HTML isn’t that hard, PHP is harder and regex is even harder to understand and learn. But unless you’re a serious masochist, regex is the only way to filter out anchor tags from HTML chunks.


im sorry you misunderstood me. I have an ok knowledge of html (I know that h1 tags dont have links) But I have little php experience.

Though I will look into Regex.




Regex is pretty complex… I think I can tell it to search for the href attribute after the h1 tag, but I am not sure how to include this in a php statement?

Any Ideas?



How about preg_match or preg_replace? Wouldn’t either of those be good?


dw about it…

I decided to switch to wordpress… it does it for me!