Test, validate and match regular expressions
Validates Sri Lankan National Identity Card (NIC) numbers in both old and new formats. The old format matches 9 digits (first digit 1-9) followed by a letter V, v, X, or x (e.g., 853422345V), while the new format matches a 12-digit number starting with a non-zero digit, typically beginning with the birth year (e.g., 198534223456). Useful for form validation and identity verification. Note that the ^ anchor only applies to the first alternative and $ only to the second, allowing partial matches on the unanchored ends.