0

I would like to delete the first occuring pattern in a string. There are plenty of answers at stackoverflow which suggest to use the ?-symbol to make the regex non-greedy, however I couldn't make it work.

text = "Some text, more text, even more text"
print(re.sub(".+?, ", "", text))

The print-statement delivers

even more text

and I am expecting

more text, even more text
Timo
  • 51
  • 1
  • 7

0 Answers0