Regular Expressions 101

Community Patterns

Dockerfile: Match a single RUN statement including all line continuations

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^RUN (.*?(?<! \\)$)
/
gms

Description

This will match the first RUN statement in a Dockerfile and capture all lines in that RUN statement (including those where the line continuation operator '' is used on the previous line.)

Submitted by Russ Frizzell-Carlton - 9 days ago