Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def check_regex_alphabet(regexp):
- '''
- This checks to make sure the input regex does not contain any erroneous characters.
- Since the input length is limited to 150 characters this is not time intensive operation in terms of CPU overhead.
- '''
- alphabet = [' ', 'a', 'b', 'm', 'p', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '\'', '\"', '/', '<', '>', '=', '~', '|', '*', '(', ')']
- for char in regexp:
- if char not in alphabet:
- return False
- return True
- def check_string_alphabet(string):
- '''
- This checks to make sure the input string does not contain any erroneous characters.
- Since the input length is limited to 150 characters this is not time intensive operation in terms of CPU overhead.
- '''
- alphabet = [' ', 'a', 'b', 'm', 'p', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '\'', '\"', '/', '<', '>', '=', '~']
- for char in string:
- if char not in alphabet:
- return False
- return True
Advertisement
Add Comment
Please, Sign In to add comment