in reply to
Help with Regex
Ok, I've read a few of them and decided to try and take all the html tag names out of a file and print them, however I am running into a few problems. This is what i have.
$content = "<head><body blah></body><foo></foo></head>";
while ($content =~ /<([^(?:\s|>)]+).*>.*<\/\1>/ig) {
print $1."\n";
}
This works fine as long as the html tags do not encompass other html tags. In this case they do and it will only find html. Is there something I'm doing wrong? I've tried everything.