Build, test, and debug regular expressions
This regular expression matches both opening and closing HTML span tags, including any attributes within the opening tag. It accommodates optional whitespace around the tag name and the optional forward slash for closing tags. The non-greedy matching ensures it captures the shortest possible sequence ending with a closing bracket. It is useful for extracting or removing span elements in web scraping and HTML parsing tasks.