Best Way to Get All HTML Tags Regex? Need Help with a Reliable Pattern!

20 Replies, 1545 Views

Regex and HTML? That’s a risky combo. I’ve used `/<(\w+)[^>]*>(.*?)<\/\1>/g`, and it works for basic tags, but it’s not great for nested or self-closing tags.

For something more reliable, check out tools like jsdom or lxml. They’re way better for parsing HTML than regex.

Messages In This Thread



Users browsing this thread: 1 Guest(s)