-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
))) | ||
)) |