Matches beggining, then '<', then the char class. Mabey you should change that to \w+ or [^<\/]+. Then the '>'. Now it matches that any amount of times, storing the opening tag right before '<H1>' in $1. If you don't use that tag, I would advise you take out the capturing parens and put in (?: ... ). Alright, let's move on ...
Next, it matches '<H1>' (and not '<h1>'). In the next set of parens, I think you need to take out the '<' and '>'. Also, you should match the '</h1>' tag as well. Then, it matches the next A-Za-z0-9 char. If you take out the '<' and '>' in that parens ($2 doesn't match unless you do) then there will be no A-Za-z0-9 chars left (the prev parens gobbled them up), so $3 would get the last char in between the header tag (due to backtracking).
You are checking $3 to see what's in between the header tags, and that confused me at first, but you aren't capturing anything in $2 because of those '<' and '>' chars.
Well, that was by no means a complete look at the regex, but it should have given you an idea about how errorprone parsing html is, I would look up on one of the modules like Parse::HTML to parse the html.
The 15 year old, freshman programmer,
Stephen Rawls
In reply to Re: (**corrected**) What Does This Line Do?
by srawls
in thread (**corrected**) What Does This Line Do?
by sfrattura
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |