Test, validate and match regular expressions
This regex matches lines containing a city name followed by a comma and a two-letter state or province code, such as "New York, NY". It uses multiline mode to apply to each line independently. The city part captures any non-empty sequence of characters (including spaces, commas, or symbols), while the code is restricted to exactly two ASCII letters. Common use cases include parsing location data from text files, logs, or user input where city/state pairs are listed line by line. Note that the character class [A-z] also includes non-letter symbols like [, \, ], ^, _, and `, so it is often better to use [A-Za-z] for strict letter matching.