I’m trying to use regex to parse out
tags. I’ve got the regex almost as what I need it to be, with one small problem. The problem is, the regex isn’t including the first letter of the match it finds. I’ll show you what I mean…first, here is the regex I’m using right now:
(?<=h1.*\>[a-zA-Z0-9])(.*?)(?=\<\/)
And lets say the HTML code I was looking to parse the
tags out of looked like this:
<h1 align="center"><strong><font color="#FF0000">I'm an H1 Tag!!</font></strong></h1>
The regex I’m using matches this out of the above HTML code:
‘m an H1 Tag!!
So as you can see, it is leaving out the first part of the match (the “I” in “I’m”).
So my question is, how can I use the regex I’ve got thus far to match the way I have it set up, but to include the first letter or number it finds (if it finds one)?
I think you should include the first letter in the bracket