Skip to content

Commit

Permalink
feat: ?<JavaScript_Method> ( Fixes #230 )
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage authored and James Brundage committed Sep 22, 2024
1 parent ed939b5 commit b873018
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions RegEx/JavaScript/Method.regex.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# JavaScript Method
(?<=[\r\n\;]) # After a newline or semicolon
\s{0,} # Optional whitespace
(?<MethodName>[^/\(\)\{\}]+) # Method Name
\s{0,} # Optional whitespace
(?<MemberParameters>(?<BalancedParenthesis>
\( # An open parenthesis
(?> # Followed by...
[^\(\)]+| # any number of non-parenthesis character OR
\((?<Depth>)| # an open parenthesis (in which case increment depth) OR
\)(?<-Depth>) # a closed parenthesis (in which case decrement depth)
)*(?(Depth)(?!)) # until depth is 0.
\) # followed by a closing parenthesis
)
) # Method Parameters
\s{0,} # Optional whitespace
(?<MemberBody>(?<BalancedCurlyBracket>
\{ # An open {
(?> # Followed by...
[^\{\}]+| # any number of non-bracket character OR
\{(?<Depth>)| # an open curly bracket (in which case increment depth) OR
\}(?<-Depth>) # a closed curly bracket (in which case decrement depth)
)*?(?(Depth)(?!)) # until depth is 0.
\} # followed by a }
)
) # Method Body

0 comments on commit b873018

Please sign in to comment.