Regular Expressions 101

Library entries

Javascript function declaration to arrow function declaration regex

Vote

0

Regular Expression
pcre2

/
function (?<name>[a-zA-Z0-9]+)\s*(?<arguments>\([^()]*\)(?::\s*[^{}\s]*)?)\s*(?<body>\{[^\r{}]*(?:\{[^\r{}]*(?:\{[^\r{}]*(?:\{[^\r{}]*(?:\{[^\r{}]*(?:\{[^\r{}]*\}[^\r{}]*)*\}[^\r{}]*)*\}[^\r{}]*)*\}[^\r{}]*)*\}[^\r{}]*)*\})(?:;)?
/
gm

Description

Loading markdown...
Submitted by anonymous - 9 months ago