Test, validate and match regular expressions
This regex matches the phrase "CHARACTER SET" (case-insensitive) and optionally a subsequent "COLLATE" clause, allowing any characters (including newlines) between them. It is commonly used to detect or extract character set and collation definitions in SQL statements or database configuration files. The pattern is useful for parsing multi-line SQL scripts where these clauses may span multiple lines.