Skip to content

Commit 38633d5

Browse files
Merge pull request #174 from StartAutomating/Irregular-Updates
Irregular 0.7.7
2 parents 51e8035 + 432fc91 commit 38633d5

19 files changed

+149
-19
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
## 0.7.6:
1+
## 0.7.7:
2+
3+
New Patterns:
4+
5+
* ?<Code_Method> : Matches methods in most languages (Fixes #171)
6+
* ?<Code_PackageVersion> : Matches a package name and version (Fixes #172)
7+
* ?<ANSI_Link> : Matches an ANSI Hyperlink (Fixes #173)
8+
9+
---
10+
11+
## 0.7.6:
212

313
* New-RegEx improvements:
414
* Now supporting new character classes: MarkSpacing, MarkEnclosing, MarkNonEnclosing (Fixes #168)

Irregular.format.ps1xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-16"?>
2-
<!-- Generated with EZOut 1.9.7: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
2+
<!-- Generated with EZOut 1.9.9: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
33
<Configuration>
44
<ViewDefinitions>
55
<View>

Irregular.psd1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
@{
2-
ModuleVersion = '0.7.6'
2+
ModuleVersion = '0.7.7'
33
RootModule = 'Irregular.psm1'
44
Description = 'Regular Expressions made Strangely Simple'
55
FormatsToProcess = 'Irregular.format.ps1xml'
66
TypesToProcess = 'Irregular.types.ps1xml'
77
Guid = '39eb966d-7437-4e2c-abae-a496e933fb23'
88
Author = 'James Brundage'
9-
Copyright = '2019-2021 Start-Automating'
9+
Copyright = '2019-2022 Start-Automating'
1010
PrivateData = @{
1111
PSData = @{
1212
Tags = 'RegularExpressions', 'RegEx', 'Irregular', 'PatternMatching', 'PipeScript'
1313
ProjectURI = 'https://github.com/StartAutomating/Irregular'
1414
LicenseURI = 'https://github.com/StartAutomating/Irregular/blob/master/LICENSE'
1515
IconURI = 'https://github.com/StartAutomating/Irregular/blob/master/Assets/Irregular_600_Square.png'
1616
ReleaseNotes = @'
17+
## 0.7.7:
18+
19+
New Patterns:
20+
21+
* ?<Code_Method> : Matches methods in most languages (Fixes #171)
22+
* ?<Code_PackageVersion> : Matches a package name and version (Fixes #172)
23+
* ?<ANSI_Link> : Matches an ANSI Hyperlink (Fixes #173)
24+
25+
---
26+
1727
## 0.7.6:
1828
1929
* New-RegEx improvements:

Irregular.types.ps1xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-16"?>
2-
<!-- Generated with EZOut 1.9.7: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
2+
<!-- Generated with EZOut 1.9.9: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
33
<Types>
44
<Type>
55
<Name>Irregular.Match.Extract</Name>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h2>Regular Expressions made Strangely Simple</h2>
44
<h3>A PowerShell module that helps you understand, use, and build Regular Expressions.</h3>
55
<h4>
6-
<a href='https://github.com/StartAutomating/Irregular/releases/tag/v0.7.6'>v 0.7.6 </a>
6+
<a href='https://github.com/StartAutomating/Irregular/releases/tag/v0.7.7'>v 0.7.7 </a>
77
</h4>
88
<a href='https://www.powershellgallery.com/packages/Irregular/'>
99
<img src='https://img.shields.io/powershellgallery/dt/Irregular' />
@@ -32,7 +32,7 @@ Once you understand some basics of that syntax, regular expressions become a lot
3232
3. A Regex can have comments! ( # Like this in .NET ( or like (?#this comment) in ECMAScript ) ).
3333
4. You don't have to do it all in one expression!
3434

35-
Irregular comes with 134 useful [named expressions](SavedPatterns.md), and lets you create more.
35+
Irregular comes with 138 useful [named expressions](SavedPatterns.md), and lets you create more.
3636

3737
To see the expressions that ship with Irregular, run:
3838

RegEx/ANSI/Link.regex.source.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt'
2+
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path
3+
4+
New-RegEx -Description "Matches ANSI Hyperlink" |
5+
New-RegEx -CharacterClass Escape -Comment 'An Escape' |
6+
New-RegEx -LiteralCharacter ']' -Comment 'Followed by a right bracket' |
7+
New-RegEx -Pattern '8[^;]{0,};;' -Comment 'Followed by 8 (and optional non-semicolon content) and two semicolons' |
8+
New-RegEx -Until '\e' -Name Uri -Comment 'Followed by the uri' |
9+
New-RegEx -CharacterClass Escape -Comment 'Followed by an escape' |
10+
New-RegEx -LiteralCharacter '\' -Comment 'Followed by a slash' |
11+
New-RegEx -Until '\e' -Name Text -Comment 'Followed by the link text' |
12+
New-RegEx -CharacterClass Escape -Comment 'Followed by an escape' |
13+
New-RegEx -LiteralCharacter ']' -Comment 'Followed by a right bracket' |
14+
New-RegEx -Pattern '8[^;]{0,};;' -Comment 'Followed by 8 (and optional non-semicolon content) and two semicolons' |
15+
New-RegEx -CharacterClass Escape -Comment 'Followed by an Escape' |
16+
New-RegEx -LiteralCharacter '\' -Comment 'Finally a closing slash' |
17+
Set-Content -Path (Join-Path $myRoot $myName)

RegEx/ANSI/Link.regex.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Matches ANSI Hyperlink
2+
\e # An Escape
3+
\] # Followed by a right bracket
4+
8[^;]{0,};; # Followed by 8 and two semicolons
5+
(?<Uri>(?:.|\s){0,}?(?=\z|\e)) # Followed by the uri
6+
\e # Followed by an escape
7+
\\ # Followed by a slash
8+
(?<Text>(?:.|\s){0,}?(?=\z|\e)) # Followed by the link text
9+
\e # Followed by an escape
10+
\] # Followed by a right bracket
11+
8[^;]{0,};; # Followed by 8 and two semicolons
12+
\e # Followed by an Escape
13+
\\ # Finally a closing slash
14+

RegEx/ANSI/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Note: Using these regular expressions in the terminal may result in awkward out
1818
|[?<ANSI_Hide>](Hide.regex.txt) |Matches ANSI Hide (aka conceal) Start or End |[source](Hide.regex.source.ps1) |
1919
|[?<ANSI_Invert>](Invert.regex.txt) |Matches ANSI Invert Start or End |[source](Invert.regex.source.ps1) |
2020
|[?<ANSI_Italic>](Italic.regex.txt) |Matches ANSI Italic Start or End |[source](Italic.regex.source.ps1) |
21+
|[?<ANSI_Link>](Link.regex.txt) |Matches ANSI Hyperlink |[source](Link.regex.source.ps1) |
2122
|[?<ANSI_Note>](Note.regex.txt) |Matches an ANSI VT520 Note |[source](Note.regex.source.ps1) |
2223
|[?<ANSI_Reset>](Reset.regex.txt) |Matches an ANSI Reset (this clears formatting) |[source](Reset.regex.source.ps1) |
2324
|[?<ANSI_Strikethrough>](Strikethrough.regex.txt)|Matches ANSI Strikethrough (aka crossed out) Start or End |[source](Strikethrough.regex.source.ps1)|

RegEx/Code/Method.regex.source.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt'
2+
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path
3+
4+
New-RegEx -Description "Matches methods in most languages" |
5+
New-RegEx -After (
6+
New-RegEx -CharacterClass Punctuation, Whitespace, Tab
7+
) -Comment "Methods start after punctuation or whitespace" |
8+
New-RegEx -CharacterClass Word -LiteralCharacter _ -Repeat -Name MethodName -Comment "Method names can be any word character or undererscore" |
9+
New-RegEx -Description "A Generic Balancing Expression" -Name MethodParameters -Pattern '?<GenericBalancingExpression>' |
10+
Set-Content -Path (Join-Path $myRoot $myName)

RegEx/Code/Method.regex.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Matches methods in most languages
2+
(?<=[\p{P}\s\t]) # Methods start after punctuation or whitespace
3+
(?<MethodName>[\w_]+) # Method names can be any word character or undererscore
4+
# A Generic Balancing Expression
5+
(?<MethodParameters>(?<GenericBalancingExpression>
6+
\p{Ps} # The open punctuation
7+
(?>
8+
[^\p{Ps}\p{Pe}]+| # Anything that is neither open or closed punctuation
9+
\p{Ps}(?<Depth>)| # If it's open punctuation, increment depth
10+
\p{Pe}(?<-Depth>) # If it's closed punctuation, decrement depth
11+
)*(?(Depth)(?!)) # Match until depth is empty
12+
\p{Pe} # The closing punctuation
13+
)
14+
)

0 commit comments

Comments
 (0)