You're correct. There is some redundancies here and that's the first indication that I should stay away for it. I was playing with passing functions as arguments and just wanted to see if it was possible.
Thanks for your help. I just realized. The numbers in the string area real. So, I need to get rid of them. Could you edit your post and remove them and I will do the same? Or as Admin, delete it; if you feel there is no value to the post.
Thank you
Thanks for your help. I just realized. The numbers in the string area real. So, I need to get rid of them. Could you edit your post and remove them and I will do the same? Or as Admin, delete it; if you feel there is no value to the post.
Thank you
(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 555-555-5555 and 555-555-5555" 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__)