Skip to content

Instantly share code, notes, and snippets.

@jacobh
Created October 17, 2011 17:35
Show Gist options
  • Save jacobh/1293202 to your computer and use it in GitHub Desktop.
Save jacobh/1293202 to your computer and use it in GitHub Desktop.
regex master~
>>> string = "GM.SetupCar(VEHICLE_SPEEDO, 'Speedo', 'speedo', 'models/sickness/speedodr.mdl', 'Make: Ford, Model: Speedo', 50000, 3750, 1.29);"
>>> re.search(r"GM.SetupCar\(.*?, '(?P<name>.*?)',.*'Make: (?P<make>.*), Model: (?P<model>.*)'", string).groupdict()
{'model': 'Speedo', 'make': 'Ford', 'name': 'Speedo'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment