Skip to content

Instantly share code, notes, and snippets.

@rightson
Created November 16, 2016 05:27
Show Gist options
  • Save rightson/3352644493c5aa5f2947f9ec97a352dc to your computer and use it in GitHub Desktop.
Save rightson/3352644493c5aa5f2947f9ec97a352dc to your computer and use it in GitHub Desktop.
>>> import re
>>> src = 'LAYOUT PRIMARY "source_string"'
>>> dest = "dest_string"
>>> re.sub(r'(LAYOUT PRIMARY) "\w+"', '\\1 "%s"' % dest, src)
'LAYOUT PRIMARY "dest_string"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment