Sep-06-2021, 02:17 PM
Can you please remove the phone numbers from your post. They are real phone numbers. I forgot to remove them before posting.
Thanks.
Thanks.
(Sep-04-2021, 09:02 PM)snippsat Wrote: Like this,so if look regex source code they do same withflags=0
.
This is kind of double up just use the search function
import re def search(pattern, string, flags=0): result = re.search(pattern, string, flags) # I want to pass these as an argument to the 'search' function. if result is None: return None else: return result if __name__ == '__main__': string = "This is a string with two phone numbers " pattern = r"\d{3}-\d{3}-\d{4}" flags = re.VERBOSE | re.IGNORECASE result = search(pattern, string, flags) print(result)The argument given has to be same format then get parsing|
for free.
Them do some magic to join|
in parameter,just to take out 2 lines.
res = '|'.join(members) globals().update(RegexFlag.__members__)