Regular Expressions 101

Community Patterns

Match double quoted or single quoted multi line string in code.

0

Regular Expression
Python

r"""
("|')((?!(?!\\)(\1|\n))|(\\(.|\n))|((?!\\).))*?(\1)
"""
g

Description

This will allow for valid string parsing via a regex in popular interpreted languages like Lua, Python and Ruby.

Submitted by Siddharth Gupta - 6 years ago