Regular Expressions 101

Community Patterns

r/ProgrammerHumor comment regex

0

Regular Expression
Python

r"
(```|`)(python)?\s*?\n?(from \S+ )?import \S+(\n.*?;)*\n((.*return \S+```)|(`return \S+`))
"
gm

Description

A regex that matches comments that adhere to the rules of r/ProgrammerHumor

Submitted by anonymous - 10 months ago