php-simple-html-dom-parser
php-simple-html-dom-parser copied to clipboard
Avoid mistaken character class in pattern regex
This pattern:
([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)["']?(.*?)["']?)?\])?([\/, ]+)
Treats the -
in both the character groups as ranges rather than characters to match meaning that the regex is looking for everything including and between \w-:
rather than the three characters by themselves. The same issue is repeated near the middle of the regex.