Skip to content

Commit 19bb9e4

Browse files
Merge pull request #100 from StartAutomating/CStuffAndBugfixes
C Stuff and Bugfixes
2 parents a566fcd + ffd9a51 commit 19bb9e4

14 files changed

+191
-164
lines changed

.github/workflows/IrregularTests.yml

+16-3
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ jobs:
301301
$Parameters.UserEmail = ${env:UserEmail}
302302
$Parameters.UserName = ${env:UserName}
303303
$Parameters.TagVersionFormat = ${env:TagVersionFormat}
304+
$Parameters.ReleaseNameFormat = ${env:ReleaseNameFormat}
304305
foreach ($k in @($parameters.Keys)) {
305306
if ([String]::IsNullOrEmpty($parameters[$k])) {
306307
$parameters.Remove($k)
@@ -322,7 +323,11 @@ jobs:
322323
# The tag version format (default value: 'v$(imported.Version)')
323324
# This can expand variables. $imported will contain the imported module.
324325
[string]
325-
$TagVersionFormat = 'v$($imported.Version)'
326+
$TagVersionFormat = 'v$($imported.Version)',
327+
328+
# The release name format (default value: '$($imported.Name) $($imported.Version)')
329+
[string]
330+
$ReleaseNameFormat = '$($imported.Name) $($imported.Version)'
326331
)
327332
328333
@@ -377,7 +382,7 @@ jobs:
377382
owner = '${{github.owner}}'
378383
repo = '${{github.repository}}'
379384
tag_name = $targetVersion
380-
name = "$($imported.Name) $targetVersion"
385+
name = $ExecutionContext.InvokeCommand.ExpandString($ReleaseNameFormat)
381386
body =
382387
if ($env:RELEASENOTES) {
383388
$env:RELEASENOTES
@@ -401,6 +406,8 @@ jobs:
401406
run: |
402407
$Parameters = @{}
403408
$Parameters.ModulePath = ${env:ModulePath}
409+
$Parameters.Exclude = ${env:Exclude}
410+
$Parameters.Exclude = $parameters.Exclude -split ';' -replace '^[''"]' -replace '[''"]$'
404411
foreach ($k in @($parameters.Keys)) {
405412
if ([String]::IsNullOrEmpty($parameters[$k])) {
406413
$parameters.Remove($k)
@@ -409,7 +416,10 @@ jobs:
409416
Write-Host "::debug:: PublishPowerShellGallery $(@(foreach ($p in $Parameters.GetEnumerator()) {'-' + $p.Key + ' ' + $p.Value}) -join ' ')"
410417
& {param(
411418
[string]
412-
$ModulePath
419+
$ModulePath,
420+
421+
[string[]]
422+
$Exclude = @('.gif', '.mp4', '.jpg', '.png')
413423
)
414424
$gitHubEvent = if ($env:GITHUB_EVENT_PATH) {
415425
[IO.File]::ReadAllText($env:GITHUB_EVENT_PATH) | ConvertFrom-Json
@@ -467,7 +477,10 @@ jobs:
467477
Write-Host "Module Files:"
468478
Get-ChildItem $moduleTempPath -Recurse
469479
Write-Host "Publishing $moduleName [$($imported.Version)] to Gallery"
480+
$publishModuleCommand = Get-Command Publish-Module
470481
Publish-Module -Path $moduleTempPath -NuGetApiKey $gk
482+
483+
471484
if ($?) {
472485
Write-Host "Published to Gallery"
473486
} else {
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
name: Run GitHub Action
3+
jobs:
4+
UseIrregularAction:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Check out repository
8+
uses: actions/checkout@v2
9+
- name: Use Irregular Action
10+
uses: StartAutomating/Irregular@master
11+
id: Irregular
12+
on:
13+
push:
14+
workflow_dispatch:

.github/workflows/UpdateModuleTag.yml

-118
This file was deleted.

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
0.6.5
1+
0.6.6:
2+
---
3+
* New Regexes:
4+
* ?<C_Enum> (#98)
5+
* ?<C_Struct> (#99)
6+
* Fixing Issues with whitespace in ?<FFMpeg_Progress> (#97)
7+
8+
9+
0.6.5
210
---
311
* Renaming Regex: ?<IPV4Address> is now ?<Network_IPV4Address> (#90)
412
* New Regex: ?<Network_MACAddress> (#89)

Irregular.psd1

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
ModuleVersion = '0.6.5'
2+
ModuleVersion = '0.6.6'
33
RootModule = 'Irregular.psm1'
44
Description = 'Regular Expressions made Strangely Simple'
55
FormatsToProcess = 'Irregular.format.ps1xml'
@@ -15,6 +15,13 @@
1515
IconURI = 'https://github.com/StartAutomating/Irregular/blob/master/Assets/Irregular_600_Square.png'
1616
}
1717
ReleaseNotes = @'
18+
0.6.6:
19+
---
20+
* New Regexes:
21+
* ?<C_Enum> (#98)
22+
* ?<C_Struct> (#99)
23+
* Fixing Issues with whitespace in ?<FFMpeg_Progress> (#97)
24+
1825
0.6.5
1926
---
2027
* Renaming Regex: ?<IPV4Address> is now ?<Network_IPV4Address> (#90)

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
<img src='Assets/Irregular_Wide.png' />
33
<h2>Regular Expressions made Strangely Simple</h2>
44
<h3>A PowerShell module that helps you understand, use, and build Regular Expressions.</h3>
5+
<a href='https://www.powershellgallery.com/packages/Irregular/'>
6+
<img src='https://img.shields.io/powershellgallery/dt/Irregular' />
7+
</a>
8+
<br/>
59
<a href='https://github.com/StartAutomating/Irregular/actions/workflows/IrregularTests.yml'>
610
<img src='https://github.com/StartAutomating/Irregular/actions/workflows/IrregularTests.yml/badge.svg' />
711
</a>
12+
813
</div>
914

1015

RegEx/C/Enum.regex.source.ps1

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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 a C/C++ Enum" -Modifier IgnoreCase -Not |
5+
New-RegEx -Pattern 'enum' -Comment 'Starts with a literal enum' |
6+
New-RegEx -CharacterClass Whitespace -Min 1 -Comment 'Followed by whitespace' |
7+
New-RegEx -Name Identifier -Pattern (
8+
New-RegEx -Pattern '[_a-zA-Z]' |
9+
New-RegEx -Pattern '[_a-zA-Z0-9]' -Min 1
10+
) -Comment 'Followed by an identifier' |
11+
New-RegEx -CharacterClass Whitespace, NewLine, CarriageReturn -Min 0 -Comment 'Followed by optional whitespace' |
12+
New-RegEx -Name Comment -Pattern '//.+[\r\n]' -Optional -Comment 'Followed by an optional comment' |
13+
New-RegEx -CharacterClass Whitespace, NewLine,CarriageReturn -Min 0 -Comment 'Followed by optional whitespace' |
14+
New-RegEx -Name Values -Pattern '?<BalancedCurlyBracket>' -Comment 'Followed by balanced curly braces' |
15+
Set-Content -Path (Join-Path $myRoot $myName) -Encoding UTF8 -PassThru

RegEx/C/Enum.regex.txt

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Matches a C/C++ Enum
2+
(?-i)enum # Starts with a literal enum
3+
\s{1,} # Followed by whitespace
4+
(?<Identifier>[_a-zA-Z][_a-zA-Z0-9]{1,}) # Followed by an identifier
5+
[\s\n\r]{0,} # Followed by optional whitespace
6+
(?<Comment>//.+[\r\n])? # Followed by an optional comment
7+
[\s\n\r]{0,} # Followed by optional whitespace
8+
(?<Values>(?<BalancedCurlyBracket>
9+
\{ # An open {
10+
(?> # Followed by...
11+
[^\{\}]+| # any number of non-bracket character OR
12+
\{(?<Depth>)| # an open curly bracket (in which case increment depth) OR
13+
\}(?<-Depth>) # a closed curly bracket (in which case decrement depth)
14+
)*?(?(Depth)(?!)) # until depth is 0.
15+
\} # followed by a }
16+
)
17+
) # Followed by balanced curly braces
18+

RegEx/C/Struct.regex.source.ps1

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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 a C/C++ Struct" -Modifier IgnoreCase -Not |
5+
New-RegEx -Pattern 'struct' -Comment 'Starts with a literal struct' |
6+
New-RegEx -CharacterClass Whitespace -Min 1 -Comment 'Followed by whitespace' |
7+
New-RegEx -Name Identifier -Pattern (
8+
New-RegEx -Pattern '[_a-zA-Z]' |
9+
New-RegEx -Pattern '[_a-zA-Z0-9]' -Min 1
10+
) -Comment 'Followed by an identifier' |
11+
New-RegEx -CharacterClass Whitespace, NewLine, CarriageReturn -Min 0 -Comment 'Followed by optional whitespace' |
12+
New-RegEx -Name Comment -Pattern '//.+[\r\n]' -Optional -Comment 'Followed by an optional comment' |
13+
New-RegEx -CharacterClass Whitespace, NewLine,CarriageReturn -Min 0 -Comment 'Followed by optional whitespace' |
14+
New-RegEx -Name Values -Pattern '?<BalancedCurlyBracket>' -Comment 'Followed by balanced curly braces' |
15+
Set-Content -Path (Join-Path $myRoot $myName) -Encoding UTF8 -PassThru

RegEx/C/Struct.regex.txt

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Matches a C/C++ Struct
2+
(?-i)struct # Starts with a literal struct
3+
\s{1,} # Followed by whitespace
4+
(?<Identifier>[_a-zA-Z][_a-zA-Z0-9]{1,}) # Followed by an identifier
5+
[\s\n\r]{0,} # Followed by optional whitespace
6+
(?<Comment>//.+[\r\n])? # Followed by an optional comment
7+
[\s\n\r]{0,} # Followed by optional whitespace
8+
(?<Values>(?<BalancedCurlyBracket>
9+
\{ # An open {
10+
(?> # Followed by...
11+
[^\{\}]+| # any number of non-bracket character OR
12+
\{(?<Depth>)| # an open curly bracket (in which case increment depth) OR
13+
\}(?<-Depth>) # a closed curly bracket (in which case decrement depth)
14+
)*?(?(Depth)(?!)) # until depth is 0.
15+
\} # followed by a }
16+
)
17+
) # Followed by balanced curly braces
18+

RegEx/FFmpeg/Progress.regex.source.ps1

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ $myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path
33
Write-RegEx -Description @'
44
Matches Progress Lines in FFMpeg output
55
'@ -StartAnchor LineStart -Pattern "frame=" -Comment "frame=" |
6-
Write-RegEx -CharacterClass Whitespace -Repeat |
6+
Write-RegEx -CharacterClass Whitespace -Min 0 |
77
Write-RegEx -Name FrameNumber -CharacterClass Digit -Repeat |
8-
Write-RegEx -CharacterClass Whitespace -Repeat -Comment "Followed by the Frame Number" |
8+
Write-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Frame Number" |
99
Write-RegEx -Pattern fps= -Comment "fps="|
1010
Write-RegEx -CharacterClass Whitespace -Min 0 |
1111
Write-RegEx -Name FramesPerSecond (
@@ -24,12 +24,12 @@ Matches Progress Lines in FFMpeg output
2424
Write-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Time" |
2525
Write-RegEx -Pattern bitrate= -Comment "bitrate=" |
2626
Write-RegEx -CharacterClass Whitespace -Min 0 |
27-
Write-RegEx -Name Bitrate -Pattern "[\d\.]+" |
27+
Write-RegEx -Name Bitrate -Pattern "[\d\.exN/A]+" |
2828
Write-RegEx -Pattern 'kbits/s' |
2929
Write-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Bitrate" |
3030
Write-RegEx -Pattern speed= -Comment "speed=" |
3131
Write-RegEx -CharacterClass Whitespace -Min 0 |
32-
Write-RegEx -Name Speed -Pattern "[\d\.]+" |
32+
Write-RegEx -Name Speed -Pattern "[\d\.N/A+]+" |
3333
Write-RegEx -Pattern 'x' |
3434
Write-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Speed" |#>
3535
Set-Content -Path (Join-Path $myRoot $myName) -Encoding UTF8 -PassThru

RegEx/FFmpeg/Progress.regex.txt

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Matches Progress Lines in FFMpeg output
2-
^frame= # frame=
3-
\s+(?<FrameNumber>\d+)\s+ # Followed by the Frame Number
4-
fps= # fps=
5-
\s{0,}(?<FramesPerSecond>[\d\.]+)\s+ # Followed by Frames Per Second
6-
q= # q=
7-
(?<QuanitizerScale>[\d\.]+)\s+ # Followed by the Quanitizer Scale
8-
L?size= # size=
9-
\s+(?<Size>\d{1,}\wB)\s+ # Followed by the Size
10-
time= # time=
11-
(?<Time>[\d\:\.]+)\s{0,} # Followed by the Time
12-
bitrate= # bitrate=
13-
\s{0,}(?<Bitrate>[\d\.]+)kbits/s\s{0,} # Followed by the Bitrate
14-
speed= # speed=
15-
\s{0,}(?<Speed>[\d\.]+)x\s{0,} # Followed by the Speed
2+
^frame= # frame=
3+
\s{0,}(?<FrameNumber>\d+)\s{0,} # Followed by the Frame Number
4+
fps= # fps=
5+
\s{0,}(?<FramesPerSecond>[\d\.]+)\s+ # Followed by Frames Per Second
6+
q= # q=
7+
(?<QuanitizerScale>[\d\.]+)\s+ # Followed by the Quanitizer Scale
8+
L?size= # size=
9+
\s+(?<Size>\d{1,}\wB)\s+ # Followed by the Size
10+
time= # time=
11+
(?<Time>[\d\:\.]+)\s{0,} # Followed by the Time
12+
bitrate= # bitrate=
13+
\s{0,}(?<Bitrate>[\d\.exN/A]+)kbits/s\s{0,} # Followed by the Bitrate
14+
speed= # speed=
15+
\s{0,}(?<Speed>[\d\.N/A+]+)x\s{0,} # Followed by the Speed
1616

UpdateSavedPatterns.md.irregular.ps1

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
$savedPatternsMarkdown = @(
2+
'### Irregular Patterns'
3+
4+
@(Get-RegEx | # Gets all saved Regular Expressions as a Markdown table
5+
Sort-Object Name |
6+
ForEach-Object -Begin {
7+
'|Name|Description|IsGenerator|'
8+
'|:---|:----------|:----------|'
9+
} -Process {
10+
$desc = $_.Description -replace '[\[\{\(]', '\$0'
11+
$desc= if ($desc) {$desc | ?<NewLine> -Replace '<br/>'} else { ''}
12+
"|$($_.Name)|$desc|$($_.IsGenerator)|"
13+
}) -join [Environment]::NewLine -replace '<br/>\|', '|'
14+
)
15+
16+
17+
$savedPatternsMarkdown | Set-Content .\SavedPatterns.md -Encoding UTF8
18+
Get-Item .\SavedPatterns.md |
19+
Add-Member NoteProperty CommitMessage "Updating SavedPatterns.md [skip ci]" -Force -PassThru
20+
21+
22+

0 commit comments

Comments
 (0)