Skip to content

Commit f1f4712

Browse files
author
James Brundage
committed
Adding ?<RegularExpression_GroupName> (Fixes #195)
1 parent ef7e2f8 commit f1f4712

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt'
2+
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path
3+
New-RegEx -Description @'
4+
Matches a regular expression group name
5+
'@ -NotAfter '\\' -LiteralCharacter '(' -Comment 'Named Groups start with a Parenthesis' |
6+
New-RegEx -LiteralCharacter '?' -Comment 'Followed by a Question Mark' |
7+
New-RegEx -LiteralCharacter '<' -Comment 'Followed by Less Than' |
8+
New-RegEx -Name 'IsBalancingGroup' -Optional -LiteralCharacter '-' -Comment "A dash can indicate a balancing group" |
9+
New-RegEx -CharacterClass Word -Repeat -Comment 'Most group names are simply any number of word characters' -Name Group |
10+
New-RegEx -LiteralCharacter '>' |
11+
Set-Content -Path (Join-Path $myRoot $myName) -PassThru
12+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Matches a regular expression group name
2+
(?<!\\)\( # Named Groups start with a Parenthesis
3+
\? # Followed by a Question Mark
4+
\< # Followed by Less Than
5+
(?<IsBalancingGroup>\-)? # A dash can indicate a balancing group
6+
(?<Group>\w+) # Most group names are simply any number of word characters
7+
\>

0 commit comments

Comments
 (0)