#!/usr/bin/env python3
import re

if __name__ == '__main__':
    for _ in range(int(input())):
        try:
            re.compile(input())
            print('True')
        except:
            print('False')

Add incoreect_regex.py solution