Regular Expressions 101

Community Patterns

Catch multiline escaped text between quotes

1

Regular Expression
ECMAScript (JavaScript)

/
(["\'`])((\s|((\\)*)\\.|.)*?)\1
/
g

Description

Catch multiline escaped text between quotes:

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title>Catch quotes</title>
        </head>
        <body>
            <Page data-info='Nobody\'s fool' />
            <CodeCopier text=`
                <h2>It is a</h2>
                <h3>functional component</h3>
                `>
                <h1>Hello World!</h1>
            </CodeCopier>
        </body>
    </html>
Submitted by David Blanchard - a year ago (Last modified 10 months ago)