0

I'm trying to apply a regex to a string, but my match is incomplete.

import re

text = 'This car costs 15400 euros (15 400 €)'
regex = re.findall(r"\d+\s(euros?|€|tcc)?\s\(\d+\s?\d+\s?(euros?|€|tcc)\)", text)

print(regex)

output:

('euros', '€')

good output:

15400 euros (15 400 €)
ladybug
  • 572
  • 2
  • 4
  • 13

0 Answers0