Test, validate and match regular expressions
Matches exactly the two-letter postal abbreviations for all 50 US states, plus Washington DC and territories such as PR and VI. Anchored with ^ and $ in multiline mode, it validates each state code as a full line on its own, rejecting partial or invalid codes. Commonly used for validating address forms, shipping inputs, or state columns in CSV and data files.