Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Python

r"
.*def[\s\\]*?(\w+)[\s\\]*?\(([\w\W]*?)\)(?:[\s\\]*?->[\s\\]*?([\w\(\)\[\]\,]+))?[\s\\]*?:
"
gm

Description

This regex will match function declerations in python

Submitted by danielnachumdev - 6 months ago