Test, validate and match regular expressions
This regular expression captures all text from the beginning of a string up to the first occurrence of an HTML <br> tag. It uses a non-greedy match for any character ([\s\S]*?) to ensure it stops at the very first line break, while the i flag makes the tag matching case-insensitive. It is highly effective for parsing HTML-encoded error messages or alerts where the primary content needs to be isolated from the rest of the details.