Build, test, and debug regular expressions
This regex matches lines that either consist of a single 'a' or 'b', or start and end with the exact same character ('a' or 'b') with any characters in between. Using the global and multiline flags, it evaluates each line independently. It is ideal for string validation exercises testing if the first and last specified characters match.