Skip to content

Commit e7a9193

Browse files
Merge pull request #129 from StartAutomating/IrregularMusic
Irregular music
2 parents 8ce7865 + 26c0f87 commit e7a9193

23 files changed

+246
-86
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
## 0.7.0:
1+
## 0.7.1:
2+
* New Pattern:
3+
* ?<ANSI_Note> (Match ANSI VT520 / DECPS note sequences) (Fixes #127)
4+
* Updated Patterns:
5+
* ?<FFMpeg_Progress>: Supporting duplicated / dropped frames (Fixes #128)
6+
* ?<Code_BuildVersion>: No longer matching if preceeded by punctuation (Fixes #126)
7+
---
8+
9+
## 0.7.0:
210
* New Patterns:
311
* ANSI
412
* ?<ANSI_Code> (Fixes #123)

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.0: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
2+
<!-- Generated with EZOut 1.9.2: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
33
<Configuration>
44
<ViewDefinitions>
55
<View>

Irregular.psd1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
ModuleVersion = '0.7.0'
2+
ModuleVersion = '0.7.1'
33
RootModule = 'Irregular.psm1'
44
Description = 'Regular Expressions made Strangely Simple'
55
FormatsToProcess = 'Irregular.format.ps1xml'
@@ -14,6 +14,13 @@
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.1:
18+
* New Pattern:
19+
* ?<ANSI_Note> (Match ANSI VT520 / DECPS note sequences) (Fixes #127)
20+
* Updated Patterns:
21+
* ?<FFMpeg_Progress>: Supporting duplicated / dropped frames (Fixes #128)
22+
* ?<Code_BuildVersion>: No longer matching if preceeded by punctuation (Fixes #126)
23+
---
1724
## 0.7.0:
1825
* New Patterns:
1926
* ANSI

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.0: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
2+
<!-- Generated with EZOut 1.9.2: 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.0'>v 0.7.0 </a>
6+
<a href='https://github.com/StartAutomating/Irregular/releases/tag/v0.7.1'>v 0.7.1 </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 118 useful [named expressions](SavedPatterns.md), and lets you create more.
35+
Irregular comes with 119 useful [named expressions](SavedPatterns.md), and lets you create more.
3636

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

RegEx/ANSI/Note.regex.source.ps1

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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 an ANSI VT520 Note" |
5+
New-RegEx -CharacterClass Escape -Comment 'An Escape' |
6+
New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' |
7+
New-RegEx -Name Volume -Atomic -Or -Pattern @(
8+
New-RegEx -Name VolumeOff -Pattern 0 -Comment "0 is no volume"
9+
New-RegEx -Name VolumeLow -Pattern '[1-3]' -Comment "1-3 is low volume"
10+
New-RegEx -Name VolumeHigh -Pattern '[4-7]' -Comment "4-7 is high volume"
11+
) |
12+
New-RegEx -LiteralCharacter ';' -Comment 'A semicolon separated the volume from the duration' |
13+
New-RegEx -Name Duration -Description "Duration is measured in 1/32 of a second" -Pattern '\d+' |
14+
New-RegEx -LiteralCharacter ';' -Comment 'A semicolon separates the duration from the note' |
15+
New-RegEx -Name Notes -Description "One or more notes will follow" -Pattern (
16+
New-RegEx -NoCapture -Min 0 (
17+
New-RegEx -Atomic -Or @(
18+
New-RegEx -Pattern 25 -Name 'C7' -Comment '25 is C in the 7th octave (MIDI 96)'
19+
New-RegEx -Pattern 24 -Name 'B6' -Comment '24 is B in the 6th octave (MIDI 95)'
20+
New-RegEx -Pattern 23 -Name 'ASharp6' -Comment '23 is A Sharp in the 6th octave (MIDI 94)'
21+
New-RegEx -Pattern 22 -Name 'A6' -Comment '22 is A in the 6th octave (MIDI 93)'
22+
New-RegEx -Pattern 21 -Name 'GSharp6' -Comment '21 is G Sharp in the 6th octave (MIDI 92)'
23+
New-RegEx -Pattern 20 -Name 'G6' -Comment '20 is G in the 6th octave (MIDI 91)'
24+
New-RegEx -Pattern 19 -Name 'FSharp6' -Comment '19 is F Sharp in the 6th octave (MIDI 90)'
25+
New-RegEx -Pattern 18 -Name 'F6' -Comment '18 is F in the 6th octave (MIDI 89)'
26+
New-RegEx -Pattern 17 -Name 'E6' -Comment '17 is E in the 6th octave (MIDI 88)'
27+
New-RegEx -Pattern 16 -Name 'DSharp6' -Comment '16 is D Sharp in the 6th octave (MIDI 87)'
28+
New-RegEx -Pattern 15 -Name 'D6' -Comment '15 is D in the 6th octave (MIDI 86)'
29+
New-RegEx -Pattern 14 -Name 'CSharp6' -Comment '14 is C Sharp in the 6th octave (MIDI 85)'
30+
New-RegEx -Pattern 13 -Name 'C6' -Comment '13 is C in the 6th octave (MIDI 84)'
31+
New-RegEx -Pattern 12 -Name 'B5' -Comment "12 is B in the 5th octave (MIDI 83)"
32+
New-RegEx -Pattern 11 -Name 'ASharp5' -Comment "11 is A Sharp in the 5th octave (MIDI 82)"
33+
New-RegEx -Pattern 10 -Name 'A5' -Comment "10 is A in the 5th octave (MIDI 81)"
34+
New-RegEx -Pattern 9 -Name 'GSharp5' -Comment "9 is G Sharp in the 5th octave (MIDI 80)"
35+
New-RegEx -Pattern 8 -Name 'G5' -Comment "8 is G in the 5th octave (MIDI 79)"
36+
New-RegEx -Pattern 7 -Name 'FSharp5' -Comment "7 is F Sharp in the 5th octave (MIDI 78)"
37+
New-RegEx -Pattern 6 -Name 'F5' -Comment "6 is F in the 5th octave (MIDI 77)"
38+
New-RegEx -Pattern 5 -Name 'E5' -Comment "5 is E in the 5th octave (MIDI 76)"
39+
New-RegEx -Pattern 4 -Name 'DSharp5' -Comment "4 is D Sharp in the 5th octave (MIDI 75)"
40+
New-RegEx -Pattern 3 -Name 'D5' -Comment "3 is D in the 5th octave (MIDI 74)"
41+
New-RegEx -Pattern 2 -Name 'CSharp5' -Comment "2 is C Sharp in the 5th octave (MIDI 73)"
42+
New-RegEx -Pattern 1 -Name 'C5' -Comment "1 is C in the 5th octave (MIDI 72)"
43+
New-RegEx -Pattern 0 -Name 'Rest' -Comment "0 is a rest"
44+
) |
45+
New-RegEx -LiteralCharacter ';' -Optional
46+
)
47+
) |
48+
New-RegEx -Pattern ',~' -Comment "A command and a tilda end the sequence" |
49+
Set-Content -Path (Join-Path $myRoot $myName)
50+

RegEx/ANSI/Note.regex.txt

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Matches an ANSI VT520 Note
2+
\e # An Escape
3+
\[ # Followed by a bracket
4+
(?>
5+
(?<Volume>(?<VolumeOff>0) # 0 is no volume
6+
|
7+
(?<VolumeLow>[1-3]) # 1-3 is low volume
8+
|
9+
(?<VolumeHigh>[4-7]) # 4-7 is high volume
10+
))\; # A semicolon separated the volume from the duration
11+
# Duration is measured in 1/32 of a second
12+
(?<Duration>\d+)\; # A semicolon separates the duration from the note
13+
# One or more notes will follow
14+
(?<Notes>(?:(?>
15+
(?<C5>25) # 25 is C in the 6th octave (MIDI 96)
16+
|
17+
(?<B5>24) # 24 is B in the 5th octave (MIDI 95)
18+
|
19+
(?<ASharp5>23) # 23 is A Sharp in the 5th octave (MIDI 94)
20+
|
21+
(?<A5>22) # 22 is A in the 5th octave (MIDI 93)
22+
|
23+
(?<GSharp5>21) # 21 is G Sharp in the 5th octave (MIDI 92)
24+
|
25+
(?<G5>20) # 20 is G in the 5th octave (MIDI 91)
26+
|
27+
(?<FSharp5>19) # 19 is F Sharp in the 5th octave (MIDI 90)
28+
|
29+
(?<F5>18) # 18 is F in the 5th octave (MIDI 89)
30+
|
31+
(?<E5>17) # 17 is F in the 5th octave (MIDI 88)
32+
|
33+
(?<DSharp5>16) # 16 is D Sharp in the 5th octave (MIDI 87)
34+
|
35+
(?<D5>15) # 15 is D in the 5th octave (MIDI 86)
36+
|
37+
(?<CSharp5>14) # 14 is C Sharp in the 5th octave (MIDI 85)
38+
|
39+
(?<C5>13) # 13 is C in the 5th octave (MIDI 84)
40+
|
41+
(?<B4>12) # 12 is B in the 4th octave (MIDI 83)
42+
|
43+
(?<ASharp4>11) # 11 is A Sharp in the 4th octave (MIDI 82)
44+
|
45+
(?<A4>10) # 10 is A in the 4th octave (MIDI 81)
46+
|
47+
(?<GSharp4>9) # 9 is G Sharp in the 4th octave (MIDI 80)
48+
|
49+
(?<G4>8) # 8 is G in the 4th octave (MIDI 79)
50+
|
51+
(?<FSharp4>7) # 7 is F Sharp in the 4th octave (MIDI 78)
52+
|
53+
(?<F4>6) # 6 is F in the 4th octave (MIDI 77)
54+
|
55+
(?<E4>5) # 5 is E in the 4th octave (MIDI 76)
56+
|
57+
(?<DSharp4>4) # 4 is D Sharp in the 4th octave (MIDI 75)
58+
|
59+
(?<D4>3) # 3 is D in the 4th octave (MIDI 74)
60+
|
61+
(?<CSharp4>2) # 2 is C Sharp in the 4th octave (MIDI 73)
62+
|
63+
(?<C4>1) # 1 is C in the 4th octave (MIDI 72)
64+
)\;?){0,}),~ # A command and a tilda end the sequence
65+

RegEx/ANSI/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ Note: Using these regular expressions in the terminal may result in awkward out
1111
|[?<ANSI_Code>](Code.regex.txt) |Matches an ANSI escape code |False |
1212
|[?<ANSI_Color>](Color.regex.txt) |Matches an ANSI color |False |
1313
|[?<ANSI_DefaultColor>](DefaultColor.regex.txt)|Matches an ANSI 24-bit color |False |
14+
|[?<ANSI_Note>](Note.regex.txt) |Matches an ANSI VT520 Note |False |
1415

1516

RegEx/Code/BuildVersion.regex.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Matches a build version
2-
(?<Major>\d+)
3-
\.
4-
(?<Minor>\d+)
5-
(?:\.(?<Build>\d+))?
6-
(?:\.(?<Revision>\d+))?
2+
(?!\p{P}) # Do not match if preceeded by punctuation
3+
(?<Major>\d+) # Match a major version
4+
\. # followed by a period
5+
(?<Minor>\d+) # followed by a minor version
6+
(?:\.(?<Build>\d+))? # followed by an optional build number
7+
(?:\.(?<Revision>\d+))? # followed by an optional build revision.
Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,47 @@
11
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt'
22
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path
3-
Write-RegEx -Description @'
3+
New-RegEx -Description @'
44
Matches Progress Lines in FFMpeg output
55
'@ -StartAnchor LineStart -Pattern "frame=" -Comment "frame=" |
6-
Write-RegEx -CharacterClass Whitespace -Min 0 |
7-
Write-RegEx -Name FrameNumber -CharacterClass Digit -Repeat |
8-
Write-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Frame Number" |
9-
Write-RegEx -Pattern fps= -Comment "fps="|
10-
Write-RegEx -CharacterClass Whitespace -Min 0 |
11-
Write-RegEx -Name FramesPerSecond (
12-
Write-RegEx -CharacterClass Digit -LiteralCharacter '.' -Repeat
6+
New-RegEx -CharacterClass Whitespace -Min 0 |
7+
New-RegEx -Name FrameNumber -CharacterClass Digit -Repeat |
8+
New-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Frame Number" |
9+
New-RegEx -Pattern fps= -Comment "fps="|
10+
New-RegEx -CharacterClass Whitespace -Min 0 |
11+
New-RegEx -Name FramesPerSecond (
12+
New-RegEx -CharacterClass Digit -LiteralCharacter '.' -Repeat
1313
) |
14-
Write-RegEx -CharacterClass Whitespace -Repeat -Comment "Followed by Frames Per Second" |
15-
Write-RegEx -Pattern q= -Comment "q=" |
16-
Write-RegEx -Name QuanitizerScale -CharacterClass Digit -LiteralCharacter . -Repeat |
17-
Write-RegEx -CharacterClass Whitespace -Repeat -Comment "Followed by the Quanitizer Scale" |
18-
Write-RegEx -Pattern L?size= -Comment "size=" |
19-
Write-RegEx -CharacterClass Whitespace -Repeat |
20-
Write-RegEx -Name Size -Pattern "\d{1,}\wB" |
21-
Write-RegEx -CharacterClass Whitespace -Repeat -Comment "Followed by the Size" |
22-
Write-RegEx -Pattern time= -Comment "time=" |
23-
Write-RegEx -Name Time -Pattern "[\d\:\.]+" |
24-
Write-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Time" |
25-
Write-RegEx -Pattern bitrate= -Comment "bitrate=" |
26-
Write-RegEx -CharacterClass Whitespace -Min 0 |
27-
Write-RegEx -Name Bitrate -Pattern "[\d\.exN/A]+" |
28-
Write-RegEx -Pattern 'kbits/s' |
29-
Write-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Bitrate" |
30-
Write-RegEx -Pattern speed= -Comment "speed=" |
31-
Write-RegEx -CharacterClass Whitespace -Min 0 |
32-
Write-RegEx -Name Speed -Pattern "[\d\.N/A+]+" |
33-
Write-RegEx -Pattern 'x' |
34-
Write-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Speed" |#>
14+
New-RegEx -CharacterClass Whitespace -Repeat -Comment "Followed by Frames Per Second" |
15+
New-RegEx -Pattern q= -Comment "q=" |
16+
New-RegEx -Name QuanitizerScale -Pattern "[\d\.N/A+]+" |
17+
New-RegEx -CharacterClass Whitespace -Repeat -Comment "Followed by the Quanitizer Scale" |
18+
New-RegEx -Pattern L?size= -Comment "size=" |
19+
New-RegEx -CharacterClass Whitespace -Repeat |
20+
New-RegEx -Name Size -Pattern "\d{1,}\wB" |
21+
New-RegEx -CharacterClass Whitespace -Repeat -Comment "Followed by the Size" |
22+
New-RegEx -Pattern time= -Comment "time=" |
23+
New-RegEx -Name Time -Pattern "[\d\:\.]+" |
24+
New-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Time" |
25+
New-RegEx -Pattern bitrate= -Comment "bitrate=" |
26+
New-RegEx -CharacterClass Whitespace -Min 0 |
27+
New-RegEx -Name Bitrate -Pattern "[\d\.exN/A]+" |
28+
New-RegEx -Pattern 'kbits/s' |
29+
New-RegEx -Atomic -Min 0 -Pattern (
30+
New-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by optional duplicated frame count" |
31+
New-RegEx -Pattern dup= -Comment "dup=" |
32+
New-RegEx -CharacterClass Whitespace -Min 0 |
33+
New-RegEx -Name Duplicated -Pattern "\d+"
34+
) |
35+
New-RegEx -Atomic -Min 0 -Pattern (
36+
New-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by optional dropped frame count" |
37+
New-RegEx -Pattern drop= -Comment "drop=" |
38+
New-RegEx -CharacterClass Whitespace -Min 0 |
39+
New-RegEx -Name Dropped -Pattern "\d+"
40+
) |
41+
New-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Bitrate" |
42+
New-RegEx -Pattern speed= -Comment "speed=" |
43+
New-RegEx -CharacterClass Whitespace -Min 0 |
44+
New-RegEx -Name Speed -Pattern "[\d\.N/A+]+" |
45+
New-RegEx -Pattern 'x' |
46+
New-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by the Speed" |#>
3547
Set-Content -Path (Join-Path $myRoot $myName) -Encoding UTF8 -PassThru

0 commit comments

Comments
 (0)