Test, validate and match regular expressions
Matches custom BBCode-style [collapse] or [collapse in] shortcode blocks that wrap an HTML heading (h2–h4) plus arbitrary content, ending with [/collapse]. The backreference \2 ensures the closing heading tag matches the opening one, while the ungreedy (U) and dotall (s) flags allow lazy matching across multiple lines. Useful for parsing or transforming collapsible sections in CMS content such as WordPress posts.