You are viewing a single comment's thread. Return to all comments →
import re
num_test_cases = int(raw_input())
for _ in range(num_test_cases): regex = raw_input() try: re.compile(regex) print(True) except re.error: print(False)
`
Seems like cookies are disabled on this browser, please enable them to open this website
Incorrect Regex
You are viewing a single comment's thread. Return to all comments →
`In Python 2
import re
num_test_cases = int(raw_input())
for _ in range(num_test_cases): regex = raw_input() try: re.compile(regex) print(True) except re.error: print(False)
`