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 +