Skip to content

Commit

Permalink
fix: Generating .regex.txt files ( Fixes #235, Fixes #236 )
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 19c650c commit 68a7748
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions RegEx/JavaScript/Class.regex.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Matches a JavaScript Class
class # Class Keyword
\s+ # Whitespace
(?<ClassName>\S){1,} # Class Name
\s{0,} # Optional whitespace
(?<ClassModifier>[^\{]{0,})\s{0,} # Optional whitespace
(?<ClassBody>(?<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 }
)
) # The class body

0 comments on commit 68a7748

Please sign in to comment.