Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(async )?(function) ([a-zA-Z0-9]+)(\([^\)]*\))(\n)?
/
gm

Description

Captures a function declaration and changes it to an arrow function with const at the beginning.

Submitted by anonymous - 2 years ago (Last modified 2 years ago)