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 7320188 commit b24a6de
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions RegEx/PowerShell/Variable.regex.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Matches a PowerShell Variable
(?<![`]) # Do not match if preceeded by a backtick (gotta allow for escape sequences)
# A PowerShell Variable Can Be Either:
(?>( # A Splatted Variable:
(?>
# A Splatted Variable:
(?<IsSplat>\@) # Which is an at sign
(?<Variable>\w+) # Followed by a <Variable> (any number of repeated word characters)
| # Or Regular Variable,
|
# Or Regular Variable,
\$ # Which starts with a dollar sign
((?<Variable>\w+) # Followed by a <Variable> (any number of repeated word characters)
| # Or a <Variable> enclosed in curly brackets
(?:(?<Variable>\w+) # Followed by a <Variable> (any number of repeated word characters)
|
# Or a <Variable> enclosed in curly brackets
(?:(?<!`){(?<Variable>(?:.|\s)*?(?=\z|(?<!`)}))(?<!`)}) # using backtick as an escape
)))
))

0 comments on commit b24a6de

Please sign in to comment.