Test, validate and match regular expressions
This regex matches any content enclosed within square brackets, including empty brackets. The non-greedy quantifier ensures it captures the shortest possible match between each pair of brackets, making it useful for extracting bracketed text from documents, code, or logs. With the global and multiline flags, it finds all occurrences across multiple lines.