Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Python

r"
(?:(?<=%\()|(?<={))([^\){]*)(?=[}\)])
"
gm

Description

Extract substitution parameters from python print strings works with

  • fstrings
  • old style format strings
  • old style %(variable) strings
Submitted by Giles Knap - a year ago