You are given a string . Your task is to find out whether is a valid regex or not. Input Format The first line contains integer , the number of test cases. The next lines contains the string . Constraints Output Format Print "True" or "False" for each test case without quotes.
from re import compile
for __ in range(int(input())):
regex: str = input("Input .*/+ or .*+ :")
try:
compile(regex)
except:
print(False)
else:
print(True)