Test, validate and match regular expressions
A Python adaptation of WordPress's core shortcode regex that matches shortcode tags like [gallery id="1"]content[/gallery] as well as self-closing forms such as [audio src="file.mp3"/]. It uses a named group for the shortcode name and captures attributes, an optional self-closing slash, the inner content between opening and closing tags, and escaped double-bracket forms like [[shortcode]]. Ideal for extracting, validating, or rendering WordPress shortcodes from post content in Python-based migrations, scrapers, or static site generators.