From b87301883d20d8d1e77c2ba0aee2a6059275adf2 Mon Sep 17 00:00:00 2001 From: James Brundage Date: Sun, 22 Sep 2024 22:16:13 +0000 Subject: [PATCH] feat: ? ( Fixes #230 ) --- RegEx/JavaScript/Method.regex.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 RegEx/JavaScript/Method.regex.txt diff --git a/RegEx/JavaScript/Method.regex.txt b/RegEx/JavaScript/Method.regex.txt new file mode 100644 index 0000000..d6345a9 --- /dev/null +++ b/RegEx/JavaScript/Method.regex.txt @@ -0,0 +1,27 @@ +# JavaScript Method +(?<=[\r\n\;]) # After a newline or semicolon +\s{0,} # Optional whitespace +(?[^/\(\)\{\}]+) # Method Name +\s{0,} # Optional whitespace +(?(? +\( # An open parenthesis +(?> # Followed by... + [^\(\)]+| # any number of non-parenthesis character OR + \((?)| # 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 +(?(? +\{ # An open { +(?> # Followed by... + [^\{\}]+| # any number of non-bracket character OR + \{(?)| # 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 +