Why do these two regular expressions work differently with re.sub(), but return the same match with re.search()?
Why do these two regular expressions work differently with re.sub(), but return the same match with re.search()? Question: Both regex are fetching same match but why does ",([d-]+)" work as expected and not the "(,d*-?d*-?d*)"? I was expecting both regex to give me same output during re.sub(). What am I missing? >>> print(re.search(r",([d-]+)", "Sabrina Green,802-867-5309,System …