Community Patterns

Community Library Entry

1

Regular Expression
Created·2023-09-24 18:24
Flavor·Python

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

Description

Extract substitution parameters from python print strings works with

  • fstrings
  • old style format strings
  • old style %(variable) strings
Submitted by Giles Knap