I am writing a tool which accepts user configuration via a json file. One piece of this config is a python regular expression and some optional regex flags. Currently the configuration for the regex flags is an array of integers which will all be run through a bitwise or (|) and sent to the re compile method.
My question is how can I validate these integers to ensure that they are valid re flags?
EDIT: Or potentially another solution to my problem... Is it possible for the user to specify the actual re flags in the JSON? I.e., [re.DEBUG, re.IGNORECASE] etc etc and then somehow translate those from the JSON file in my python script?
if option in [2, 4, 8, 16, 32, 64, 128, 256]to validate these. Just note thatre.ASCII(256) is only present in Python 3re.option_dct = { 're.I' : re.I, etc. }