Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Python

r"
([\'\"\`])(.*)\1
"
gm

Description

  • 'string in simple quotes'
  • "in double-quotes"
  • in back-quotes
  • "Works good with symbols ' or " or ` inside the string"
  • "All another type quotes "' inside string are ignored" use something like \ or " or '
  • " Matches only identical quotes on string start and end ' // regex can`t find this
  • group 1 saves quote symbol
  • group 2 saves clear text

Valid strings

  • "Something something something something"
  • 'Something something something something'
  • Something something something something
  • "Something something ' ` something something"
  • 'Something something " ` something something'
  • Something something " ' something something
  • "Something something " something something"
  • 'Something something ' something something'
  • Something something \ something something`
  • Something something \\ something something
Submitted by V. Martian - 5 years ago