-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMethod.regex.txt
More file actions
14 lines (14 loc) · 631 Bytes
/
Method.regex.txt
File metadata and controls
14 lines (14 loc) · 631 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Matches methods in most languages
(?<=[\p{P}\s\t]) # Methods start after punctuation or whitespace
(?<MethodName>[\w_]+) # Method names can be any word character or undererscore
# A Generic Balancing Expression
(?<MethodParameters>(?<GenericBalancingExpression>
\p{Ps} # The open punctuation
(?>
[^\p{Ps}\p{Pe}]+| # Anything that is neither open or closed punctuation
\p{Ps}(?<Depth>)| # If it's open punctuation, increment depth
\p{Pe}(?<-Depth>) # If it's closed punctuation, decrement depth
)*(?(Depth)(?!)) # Match until depth is empty
\p{Pe} # The closing punctuation
)
)