> I have an app that allows users to enter regexps for db searching. > When a user enters an invalid one (e.g. 'A|B|' is one I just saw) it > causes downstream issues. I'd like to flag it at entry time.
Just call re.compile(...) on it and catch any exceptions, modulo caveats about operating with unvalidated user input. Skip -- https://mail.python.org/mailman/listinfo/python-list