Drupal Association members fund grants that make connections all over the world.
The regular expression is
/<h([1-6])>(.*?)<\/h[1-6]>/. This is extremely specific to heading tags that use a lower case "h" and have no attributes. Furthermore, the substitution callback has no way to deal with existing attributes even if the regex could deal with it.
There are two paths forward:
- Improve this Regex and the substitution callback.
- Use DOM manipulation.
Case insensitive, ungreedily match on anything within the first heading tag as long as there's at least one space after the number.