From 29dbbbc11ec1874f8dea8a4c421e2d84cde0334c Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Sun, 11 Sep 2022 20:27:00 -0700 Subject: [PATCH 01/35] Adding ANSI Expressiones (Fixes #123 and #124) --- RegEx/ANSI/24BitColor.regex.source.ps1 | 16 +++++++++ RegEx/ANSI/24BitColor.regex.txt | 7 ++++ RegEx/ANSI/4BitColor.regex.source.ps1 | 16 +++++++++ RegEx/ANSI/4BitColor.regex.txt | 4 +++ RegEx/ANSI/8BitColor.regex.source.ps1 | 20 ++++++++++++ RegEx/ANSI/8BitColor.regex.txt | 12 +++++++ RegEx/ANSI/Color.regex.source.ps1 | 11 +++++++ RegEx/ANSI/Color.regex.txt | 41 ++++++++++++++++++++++++ RegEx/ANSI/DefaultColor.regex.source.ps1 | 15 +++++++++ RegEx/ANSI/DefaultColor.regex.txt | 8 +++++ RegEx/ANSI/README.ps1.md | 15 +++++++++ RegEx/ANSI/Sequence.regex.source.ps1 | 16 +++++++++ RegEx/ANSI/Sequence.regex.txt | 7 ++++ 13 files changed, 188 insertions(+) create mode 100644 RegEx/ANSI/24BitColor.regex.source.ps1 create mode 100644 RegEx/ANSI/24BitColor.regex.txt create mode 100644 RegEx/ANSI/4BitColor.regex.source.ps1 create mode 100644 RegEx/ANSI/4BitColor.regex.txt create mode 100644 RegEx/ANSI/8BitColor.regex.source.ps1 create mode 100644 RegEx/ANSI/8BitColor.regex.txt create mode 100644 RegEx/ANSI/Color.regex.source.ps1 create mode 100644 RegEx/ANSI/Color.regex.txt create mode 100644 RegEx/ANSI/DefaultColor.regex.source.ps1 create mode 100644 RegEx/ANSI/DefaultColor.regex.txt create mode 100644 RegEx/ANSI/README.ps1.md create mode 100644 RegEx/ANSI/Sequence.regex.source.ps1 create mode 100644 RegEx/ANSI/Sequence.regex.txt diff --git a/RegEx/ANSI/24BitColor.regex.source.ps1 b/RegEx/ANSI/24BitColor.regex.source.ps1 new file mode 100644 index 0000000..280691d --- /dev/null +++ b/RegEx/ANSI/24BitColor.regex.source.ps1 @@ -0,0 +1,16 @@ +$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' +$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path + +New-RegEx -Description "Matches an ANSI 24-bit color" -Modifier IgnoreCase -Not | + New-RegEx -CharacterClass Escape -Comment 'An Escape' | + New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' | + New-RegEx -Pattern '38;2;' | + New-RegEx -Name Color -Pattern ( + New-Regex -Name Red -Pattern '(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})' -Comment 'Red is the first 0-255 value' | + New-RegEx -Pattern ';' | + New-Regex -Name Red -Pattern '(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})' -Comment 'Green is the second 0-255 value' | + New-RegEx -Pattern ';' | + New-Regex -Name Blue -Pattern '(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})' -Comment 'Blue is the third 0-255 value' | + New-RegEx -Pattern 'm' + ) | + Set-Content -Path (Join-Path $myRoot $myName) diff --git a/RegEx/ANSI/24BitColor.regex.txt b/RegEx/ANSI/24BitColor.regex.txt new file mode 100644 index 0000000..0e94133 --- /dev/null +++ b/RegEx/ANSI/24BitColor.regex.txt @@ -0,0 +1,7 @@ +# Matches an ANSI 24-bit color +(?-i)\e # An Escape +\[ # Followed by a bracket +38;2;(?(?(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Red is the first 0-255 value +;(?(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Green is the second 0-255 value +;(?(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Blue is the third 0-255 value +m) diff --git a/RegEx/ANSI/4BitColor.regex.source.ps1 b/RegEx/ANSI/4BitColor.regex.source.ps1 new file mode 100644 index 0000000..93279c6 --- /dev/null +++ b/RegEx/ANSI/4BitColor.regex.source.ps1 @@ -0,0 +1,16 @@ +$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' +$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path + +New-RegEx -Description "Matches an ANSI 3 or 4-bit color" | + New-RegEx -CharacterClass Escape -Comment 'An Escape' | + New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' | + New-RegEx -Pattern ( + New-RegEx -Pattern 1 -Optional -Name IsBright | + New-RegEx -LiteralCharacter ';' -Optional | + New-RegEx -Pattern '3[0-7]' -Name ForegroundColor -Optional | + New-RegEx -If ForegroundColor -Then 'm' -Else ( + New-RegEx -Pattern '4[0-7]' -Name BackgroundColor | + New-RegEx -Pattern 'm' -Modifier IgnoreCase -Not + ) + ) -Name Color | + Set-Content -Path (Join-Path $myRoot $myName) diff --git a/RegEx/ANSI/4BitColor.regex.txt b/RegEx/ANSI/4BitColor.regex.txt new file mode 100644 index 0000000..44ccd3b --- /dev/null +++ b/RegEx/ANSI/4BitColor.regex.txt @@ -0,0 +1,4 @@ +# Matches an ANSI 3 or 4-bit color +\e # An Escape +\[ # Followed by a bracket +(?(?1)?\;?(?3[0-7])?(?(ForegroundColor)(m)|((?4[0-7])m))) diff --git a/RegEx/ANSI/8BitColor.regex.source.ps1 b/RegEx/ANSI/8BitColor.regex.source.ps1 new file mode 100644 index 0000000..75840f1 --- /dev/null +++ b/RegEx/ANSI/8BitColor.regex.source.ps1 @@ -0,0 +1,20 @@ +$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' +$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path + +New-RegEx -Description "Matches an ANSI 8-bit color" -Modifier IgnoreCase -Not | + New-RegEx -CharacterClass Escape -Comment 'An Escape' | + New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' | + New-RegEx -Pattern '38;5;' | + New-RegEx -Name Color -Pattern ( + New-RegEx -Atomic -Or @( + New-Regex -Name StandardColor -Pattern '[0-7]' -Comment '0 -7 are standard colors' | + New-RegEx -Pattern m + New-Regex -Name BrightColor -Pattern '(?>[8-9]|1[0-5])' -Comment '8-15 are bright colors' | + New-RegEx -Pattern m + New-Regex -Name CubeColor -Pattern '(?>[0-2][0-3][0-1]|[0-1]\d\d|\d{1,2})' -Comment '16-231 are cubed colors' | + New-RegEx -Pattern m + New-Regex -Name GrayscaleColor -Pattern '(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})' -Comment '232-255 are grayscales' | + New-RegEx -Pattern m + ) + ) | + Set-Content -Path (Join-Path $myRoot $myName) diff --git a/RegEx/ANSI/8BitColor.regex.txt b/RegEx/ANSI/8BitColor.regex.txt new file mode 100644 index 0000000..c5e1fe1 --- /dev/null +++ b/RegEx/ANSI/8BitColor.regex.txt @@ -0,0 +1,12 @@ +# Matches an ANSI 8 bit color +(?-i)\e # An Escape +\[ # Followed by a bracket +38;5;(?(?> + (?[0-7]) # 0 -7 are standard colors +m | + (?(?>[8-9]|1[0-5])) # 8-15 are bright colors +m | + (?(?>[0-2][0-3][0-1]|[0-1]\d\d|\d{1,2})) # 16-231 are cubed colors +m | + (?(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # 232-255 are grayscales +m)) diff --git a/RegEx/ANSI/Color.regex.source.ps1 b/RegEx/ANSI/Color.regex.source.ps1 new file mode 100644 index 0000000..0ebffc2 --- /dev/null +++ b/RegEx/ANSI/Color.regex.source.ps1 @@ -0,0 +1,11 @@ +$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' +$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path + +New-RegEx -Description "Matches an ANSI color" | + New-RegEx -Atomic -Or @( + New-RegEx -Pattern '?' + New-RegEx -Pattern '?' + New-RegEx -Pattern '?' + New-RegEx -Pattern '?' + ) | + Set-Content -Path (Join-Path $myRoot $myName) -PassThru diff --git a/RegEx/ANSI/Color.regex.txt b/RegEx/ANSI/Color.regex.txt new file mode 100644 index 0000000..cc8dc18 --- /dev/null +++ b/RegEx/ANSI/Color.regex.txt @@ -0,0 +1,41 @@ +# Matches an ANSI color +(?> + (? +(?-i)\e # An Escape +\[ # Followed by a bracket +38;2;(?(?(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Red is the first 0-255 value +;(?(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Green is the second 0-255 value +;(?(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Blue is the third 0-255 value +m) +) + | + (? +(?-i)\e # An Escape +\[ # Followed by a bracket +38;5;(?(?> + (?[0-7]) # 0 -7 are standard colors +m | + (?(?>[8-9]|1[0-5])) # 8-15 are bright colors +m | + (?(?>[0-2][0-3][0-1]|[0-1]\d\d|\d{1,2})) # 16-231 are cubed colors +m | + (?(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # 232-255 are grayscales +m)) +) + | + (? +\e # An Escape +\[ # Followed by a bracket +(?(?1)?\;?(?3[0-7])?(?(ForegroundColor)(m)|((?4[0-7])m))) +) + | + (? +(?-i)\e # An Escape +\[ # Followed by a bracket +(?(?> + (?39) # 39 Represents the default foreground color +m | + (?49) # 49 Represents the default background color +m)) +) +) diff --git a/RegEx/ANSI/DefaultColor.regex.source.ps1 b/RegEx/ANSI/DefaultColor.regex.source.ps1 new file mode 100644 index 0000000..5ae502d --- /dev/null +++ b/RegEx/ANSI/DefaultColor.regex.source.ps1 @@ -0,0 +1,15 @@ +$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' +$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path + +New-RegEx -Description "Matches an ANSI default color" -Modifier IgnoreCase -Not | + New-RegEx -CharacterClass Escape -Comment 'An Escape' | + New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' | + New-RegEx -Name Color -Pattern ( + New-RegEx -Atomic -Or @( + New-Regex -Name DefaultForeground -Pattern '39' -Comment '39 Represents the default foreground color' | + New-RegEx -Pattern 'm' + New-Regex -Name DefaultForeground -Pattern '49' -Comment '49 Represents the default background color' | + New-RegEx -Pattern 'm' + ) + ) | + Set-Content -Path (Join-Path $myRoot $myName) diff --git a/RegEx/ANSI/DefaultColor.regex.txt b/RegEx/ANSI/DefaultColor.regex.txt new file mode 100644 index 0000000..66adcc6 --- /dev/null +++ b/RegEx/ANSI/DefaultColor.regex.txt @@ -0,0 +1,8 @@ +# Matches an ANSI 24-bit color +(?-i)\e # An Escape +\[ # Followed by a bracket +(?(?> + (?39) # 39 Represents the default foreground color +m | + (?49) # 49 Represents the default background color +m)) diff --git a/RegEx/ANSI/README.ps1.md b/RegEx/ANSI/README.ps1.md new file mode 100644 index 0000000..04ee46f --- /dev/null +++ b/RegEx/ANSI/README.ps1.md @@ -0,0 +1,15 @@ +This directory contains regular expressions for [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code). + + +~~~PipeScript{ + Import-Module ../../Irregular.psd1 -Global + $directoryName = $pwd | Split-Path -Leaf + [PSCustomObject]@{ + Table = Get-Regex -Name "${directoryName}_*" | + Sort-Object Name | + Select @{ + Name='Name' + Expression={"[?<$($_.Name)>]($($_.Path | Split-Path -Leaf))"} + }, Description, IsGenerator + }} +~~~ \ No newline at end of file diff --git a/RegEx/ANSI/Sequence.regex.source.ps1 b/RegEx/ANSI/Sequence.regex.source.ps1 new file mode 100644 index 0000000..2209e61 --- /dev/null +++ b/RegEx/ANSI/Sequence.regex.source.ps1 @@ -0,0 +1,16 @@ +$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' +$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path + +New-RegEx -Description "Matches an ANSI escape code" -Modifier IgnoreCase -Not | + New-RegEx -CharacterClass Escape -Comment 'An Escape' | + New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' | + New-RegEx -Name ParameterBytes ( + New-Regex -CharacterClass Digit -LiteralCharacter ':;<=>?' -Min 0 + ) -Comment "Followed by zero or more parameter bytes" | + New-RegEx -Name IntermediateBytes ( + New-Regex -LiteralCharacter (0x21..0x2F -as [char[]]) -Min 0 -CharacterClass Whitespace + ) -Comment "Followed by zero or more intermediate bytes" | + New-RegEx -Name FinalByte ( + New-RegEx -LiteralCharacter (0x40..0x7E -as [char[]]) + ) -Comment "Followed by a final byte" | + Set-Content -Path (Join-Path $myRoot $myName) diff --git a/RegEx/ANSI/Sequence.regex.txt b/RegEx/ANSI/Sequence.regex.txt new file mode 100644 index 0000000..2c0cd69 --- /dev/null +++ b/RegEx/ANSI/Sequence.regex.txt @@ -0,0 +1,7 @@ +# Matches an ANSI escape code +(?-i)\e # An Escape +\[ # Followed by a bracket +(?[\d\:\;\<\=\>\?]{0,}) # Followed by zero or more parameter bytes +(?[\s\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/]{0,}) # Followed by zero or more intermediate bytes +(?[\@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_\`abcdefghijklmnopqrstuvwxyz\{\|\}\~]) # Followed by a final byte + From 3d383e8fcb3b2974c8e45536a98392a87686c90e Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:27:32 +0000 Subject: [PATCH 02/35] Updating SavedPatterns.md [skip ci] --- SavedPatterns.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SavedPatterns.md b/SavedPatterns.md index fff1283..f26d350 100644 --- a/SavedPatterns.md +++ b/SavedPatterns.md @@ -1,7 +1,13 @@ ### Irregular Patterns -Irregular includes 111 regular expressions +Irregular includes 117 regular expressions |Name|Description|IsGenerator| |:---|:----------|:----------| +|[ANSI_24BitColor](/RegEx/ANSI/24BitColor.regex.txt)|Matches an ANSI 24-bit color|False| +|[ANSI_4BitColor](/RegEx/ANSI/4BitColor.regex.txt)|Matches an ANSI 3 or 4-bit color|False| +|[ANSI_8BitColor](/RegEx/ANSI/8BitColor.regex.txt)|Matches an ANSI 8 bit color|False| +|[ANSI_Color](/RegEx/ANSI/Color.regex.txt)|Matches an ANSI color|False| +|[ANSI_DefaultColor](/RegEx/ANSI/DefaultColor.regex.txt)|Matches an ANSI 24-bit color|False| +|[ANSI_Sequence](/RegEx/ANSI/Sequence.regex.txt)|Matches an ANSI escape code|False| |[ArithmeticOperator](/RegEx/ArithmeticOperator.regex.txt)|Simple Arithmetic Operators|False| |[BalancedBrackets](/RegEx/BalancedBrackets.regex.txt)|Matches content in brackets, as long as it is balanced|False| |[BalancedCode](/RegEx/BalancedCode.regex.ps1)|Matches code balanced by a [, {, or (|True| From ce899ca86a54b2a81469ff9473632201aa4eaef1 Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Sun, 11 Sep 2022 20:29:03 -0700 Subject: [PATCH 03/35] Adding note about ANSI expressions --- RegEx/ANSI/README.ps1.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RegEx/ANSI/README.ps1.md b/RegEx/ANSI/README.ps1.md index 04ee46f..8c64974 100644 --- a/RegEx/ANSI/README.ps1.md +++ b/RegEx/ANSI/README.ps1.md @@ -1,5 +1,6 @@ This directory contains regular expressions for [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code). +Note: Using these regular expressions in the terminal may result in awkward output. (the .Match will contain an escape sequence, which will make the next output attempt to use this escape sequence) ~~~PipeScript{ Import-Module ../../Irregular.psd1 -Global From 84eea5bd516e3fdf590f148d94b716809cfa9c54 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:49 +0000 Subject: [PATCH 04/35] Adding note about ANSI expressions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f29ffb..b1184bd 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Once you understand some basics of that syntax, regular expressions become a lot 3. A Regex can have comments! ( # Like this in .NET ( or like (?#this comment) in ECMAScript ) ). 4. You don't have to do it all in one expression! -Irregular comes with 111 useful [named expressions](SavedPatterns.md), and lets you create more. +Irregular comes with 117 useful [named expressions](SavedPatterns.md), and lets you create more. To see the expressions that ship with Irregular, run: From 76cb2e902d2f2703af006d8d96676aa6995dc6bc Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:49 +0000 Subject: [PATCH 05/35] Adding note about ANSI expressions --- RegEx/ANSI/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 RegEx/ANSI/README.md diff --git a/RegEx/ANSI/README.md b/RegEx/ANSI/README.md new file mode 100644 index 0000000..6df70f3 --- /dev/null +++ b/RegEx/ANSI/README.md @@ -0,0 +1,15 @@ +This directory contains regular expressions for [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code). + +Note: Using these regular expressions in the terminal may result in awkward output. (the .Match will contain an escape sequence, which will make the next output attempt to use this escape sequence) + + +|Name |Description |IsGenerator| +|----------------------------------------------|--------------------------------|-----------| +|[?](24BitColor.regex.txt) |Matches an ANSI 24-bit color |False | +|[?](4BitColor.regex.txt) |Matches an ANSI 3 or 4-bit color|False | +|[?](8BitColor.regex.txt) |Matches an ANSI 8 bit color |False | +|[?](Color.regex.txt) |Matches an ANSI color |False | +|[?](DefaultColor.regex.txt)|Matches an ANSI 24-bit color |False | +|[?](Sequence.regex.txt) |Matches an ANSI escape code |False | + + From 6c10f6c2094248e7f18a727da5c13ed064d4d06a Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:55 +0000 Subject: [PATCH 06/35] Adding note about ANSI expressions --- docs/Export-RegEx.md | 58 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/docs/Export-RegEx.md b/docs/Export-RegEx.md index 4167292..f886315 100644 --- a/docs/Export-RegEx.md +++ b/docs/Export-RegEx.md @@ -12,7 +12,13 @@ Exports one or more Regular Expressions --- ### Related Links * [Import-RegEx](Import-RegEx.md) + + + * [Set-RegEx](Set-RegEx.md) + + + --- ### Examples #### EXAMPLE 1 @@ -33,9 +39,16 @@ The name of the regular expression. If not provided, this can be inferred if th -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|---------------------| -|```[String[]]```|false |1 |true (ByPropertyName)| +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 1 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Path** @@ -44,9 +57,16 @@ If this is not provided, it will export regular expressions to the user's Irregu -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[String]```|false |2 |true (ByPropertyName)| +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: 2 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **As** @@ -70,9 +90,16 @@ Valid Values: -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |3 |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: 3 + +> **PipelineInput**:false + + + --- #### **Noun** @@ -82,9 +109,16 @@ It prevents name conflicts with Irregular. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |4 |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: 4 + +> **PipelineInput**:false + + + --- #### **WhatIf** -WhatIf is an automatic variable that is created when a command has ```[CmdletBinding(SupportsShouldProcess)]```. From 42182818f6b3dc67febc5d716533552f572fe15d Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:55 +0000 Subject: [PATCH 07/35] Adding note about ANSI expressions --- docs/Get-RegEx.md | 71 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 15 deletions(-) diff --git a/docs/Get-RegEx.md b/docs/Get-RegEx.md index 8f03ac2..40238e1 100644 --- a/docs/Get-RegEx.md +++ b/docs/Get-RegEx.md @@ -12,7 +12,13 @@ Gets saved Regular Expressions. --- ### Related Links * [Use-RegEx](Use-RegEx.md) + + + * [New-RegEx](New-RegEx.md) + + + --- ### Examples #### EXAMPLE 1 @@ -47,9 +53,16 @@ The Name of the Regular Expression. -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|---------------------| -|```[String[]]```|false |1 |true (ByPropertyName)| +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 1 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **FilePath** @@ -58,9 +71,16 @@ Files should be named $Name.regex.txt -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|---------------------| -|```[String[]]```|false |2 |true (ByPropertyName)| +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 2 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **FromModule** @@ -68,9 +88,16 @@ If provided, will get regular expressions from any number of already imported mo -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |3 |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 3 + +> **PipelineInput**:false + + + --- #### **As** @@ -94,9 +121,16 @@ Valid Values: -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |4 |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: 4 + +> **PipelineInput**:false + + + --- #### **Noun** @@ -106,9 +140,16 @@ It prevents name conflicts with Irregular. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |5 |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: 5 + +> **PipelineInput**:false + + + --- ### Outputs System.Management.Automation.PSObject From 01a1520cb7ea576d84d896fa77b041c13cec7ff9 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:55 +0000 Subject: [PATCH 08/35] Adding note about ANSI expressions --- docs/Import-RegEx.md | 71 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 15 deletions(-) diff --git a/docs/Import-RegEx.md b/docs/Import-RegEx.md index 9b71968..686630b 100644 --- a/docs/Import-RegEx.md +++ b/docs/Import-RegEx.md @@ -12,7 +12,13 @@ Imports saved Regular Expressions. --- ### Related Links * [Use-RegEx](Use-RegEx.md) + + + * [New-RegEx](New-RegEx.md) + + + --- ### Examples #### EXAMPLE 1 @@ -39,9 +45,16 @@ Files should be named $Name.regex.txt or $Name.regex.ps1 -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|---------------------| -|```[String[]]```|false |1 |true (ByPropertyName)| +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 1 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **FromModule** @@ -49,9 +62,16 @@ If provided, will get regular expressions from any number of already imported mo -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |2 |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 2 + +> **PipelineInput**:false + + + --- #### **Pattern** @@ -59,9 +79,16 @@ One or more direct patterns to import -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|---------------------| -|```[String[]]```|false |3 |true (ByPropertyName)| +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 3 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Name** @@ -69,9 +96,16 @@ The Name of the Regular Expression. -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|---------------------| -|```[String[]]```|false |4 |true (ByPropertyName)| +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 4 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **PassThru** @@ -79,9 +113,16 @@ If set, will output the imported regular expressions. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- ### Outputs System.Nullable From adc79f0ab694fad795f92037f574976abf568a91 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:56 +0000 Subject: [PATCH 09/35] Adding note about ANSI expressions --- docs/New-RegEx.md | 523 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 403 insertions(+), 120 deletions(-) diff --git a/docs/New-RegEx.md b/docs/New-RegEx.md index 155bae9..38c517e 100644 --- a/docs/New-RegEx.md +++ b/docs/New-RegEx.md @@ -12,6 +12,9 @@ Helps to simplifify creating regular expressions --- ### Related Links * [Use-RegEx](Use-RegEx.md) + + + --- ### Examples #### EXAMPLE 1 @@ -69,9 +72,16 @@ One or more regular expressions. -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |1 |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 1 + +> **PipelineInput**:false + + + --- #### **Name** @@ -79,9 +89,16 @@ If provided, will name the capture -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **CharacterClass** @@ -248,9 +265,16 @@ Valid Values: -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |named |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **LiteralCharacter** @@ -258,9 +282,16 @@ If provided, will match any number of specific literal characters. -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |named |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **UnicodeCharacter** @@ -270,9 +301,16 @@ To make a RegEx explicitly case-sensitive, use New-RegEx -Modifier IgnoreCase -N -|Type |Requried|Postion|PipelineInput| -|---------------|--------|-------|-------------| -|```[Int32[]]```|false |named |false | +> **Type**: ```[Int32[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **ExcludeCharacterClass** @@ -440,9 +478,16 @@ Valid Values: -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |named |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **ExcludeLiteralCharacter** @@ -451,9 +496,16 @@ Otherwise, will match any characters that are not one of the provided literal ch -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |named |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **ExcludeUnicodeCharacter** @@ -464,9 +516,16 @@ To make a RegEx explicitly case-sensitive, use New-RegEx -Modifier IgnoreCase -N -|Type |Requried|Postion|PipelineInput| -|---------------|--------|-------|-------------| -|```[Int32[]]```|false |named |false | +> **Type**: ```[Int32[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **DigitMax** @@ -474,9 +533,16 @@ If provided, will match digits up to a value. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[UInt32]```|false |named |false | +> **Type**: ```[UInt32]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Backreference** @@ -484,9 +550,16 @@ The name or number of a backreference (a reference to a previous capture) -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **NotAfter** @@ -494,9 +567,16 @@ A negative lookbehind (? **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **NotBefore** @@ -504,9 +584,16 @@ A negative lookahead (?!). This pattern must not match before the current positi -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **After** @@ -514,9 +601,16 @@ A positive lookbehind (?<=). This pattern that must match after the current posi -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Before** @@ -524,9 +618,16 @@ A positive lookahead (?=). This pattern that must match before the current posit -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Repeat** @@ -534,9 +635,16 @@ If set, will match repeated occurances of a character class or pattern -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Greedy** @@ -547,9 +655,16 @@ $matches will be abcabc -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Lazy** @@ -560,9 +675,16 @@ $matches will be abc -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Min** @@ -570,9 +692,16 @@ The minimum number of repetitions. -|Type |Requried|Postion|PipelineInput| -|-------------|--------|-------|-------------| -|```[Int32]```|false |named |false | +> **Type**: ```[Int32]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Max** @@ -580,9 +709,16 @@ The maximum number of repetitions. -|Type |Requried|Postion|PipelineInput| -|-------------|--------|-------|-------------| -|```[Int32]```|false |named |false | +> **Type**: ```[Int32]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **If** @@ -590,9 +726,16 @@ If provided, inserts a Regular Expression conditional. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Then** @@ -600,9 +743,16 @@ If the pattern provided in -If is true, it will attempt to continue to match wit -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |named |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Else** @@ -610,9 +760,16 @@ If the pattern provided in -If if false, it will attempt to continue to match th -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |named |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Until** @@ -620,9 +777,16 @@ If provided, will match all content until any of these conditions or the end of -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |named |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Comment** @@ -630,9 +794,16 @@ A comment (yes, they exist in Regular Expressions) -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Description** @@ -640,9 +811,16 @@ A description. This will be added to the top of the expression as a comment. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Not** @@ -653,9 +831,16 @@ If set and -Modifier is provided, will negate the modifier. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Or** @@ -663,9 +848,16 @@ If set, will match any of a number of character classes, or any number of patter -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **StartAnchor** @@ -692,9 +884,16 @@ Valid Values: -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **EndAnchor** @@ -721,9 +920,16 @@ Valid Values: -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Modifier** @@ -748,9 +954,16 @@ Valid Values: -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |named |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Optional** @@ -758,9 +971,16 @@ If set, will make the pattern optional -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Atomic** @@ -768,9 +988,16 @@ If set, will make the pattern atomic. This will allow one and only one match. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **NoCapture** @@ -778,9 +1005,16 @@ If set, will make the pattern atomic. This will allow one and only one match. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **PrePattern** @@ -788,9 +1022,16 @@ A regular expression that occurs before the generated regular expression. -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|--------------| -|```[String[]]```|false |named |true (ByValue)| +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByValue) + + + --- #### **TimeOut** @@ -798,9 +1039,16 @@ The timeout of the regular expression. By default, 5 seconds. -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[TimeSpan]```|false |named |false | +> **Type**: ```[TimeSpan]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Between** @@ -808,9 +1056,16 @@ If provided, will match between a given string or pair of strings. -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[String[]]```|false |named |false | +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **EscapeSequence** @@ -818,9 +1073,16 @@ The escape sequence used with -Between. By default, a slash. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Denormalized** @@ -829,9 +1091,16 @@ By default, all comments that do not start on the beginning are normalized to st -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Parameter** @@ -839,9 +1108,16 @@ Named parameters. These are only valid if the regex is using a Generator script -|Type |Requried|Postion|PipelineInput| -|-------------------|--------|-------|-------------| -|```[IDictionary]```|false |named |false | +> **Type**: ```[IDictionary]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **ArgumentList** @@ -849,9 +1125,16 @@ A list of arguments. These are only valid if the regex is using a Generator scr -|Type |Requried|Postion|PipelineInput| -|------------------|--------|-------|-------------| -|```[PSObject[]]```|false |named |false | +> **Type**: ```[PSObject[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- ### Outputs System.Text.RegularExpressions.Regex From 2a51d2554bf359f209bfaa2ebf2475a7dc175407 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:56 +0000 Subject: [PATCH 10/35] Adding note about ANSI expressions --- docs/Remove-RegEx.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/Remove-RegEx.md b/docs/Remove-RegEx.md index de649f5..4326175 100644 --- a/docs/Remove-RegEx.md +++ b/docs/Remove-RegEx.md @@ -13,7 +13,13 @@ This will remove the associated file, any module sharing the Regex's name, and a --- ### Related Links * [Get-RegEx](Get-RegEx.md) + + + * [Set-RegEx](Set-RegEx.md) + + + --- ### Examples #### EXAMPLE 1 @@ -29,9 +35,16 @@ The name of one or more regular expressions -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|---------------------| -|```[String[]]```|true |1 |true (ByPropertyName)| +> **Type**: ```[String[]]``` + +> **Required**: true + +> **Position**: 1 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **WhatIf** -WhatIf is an automatic variable that is created when a command has ```[CmdletBinding(SupportsShouldProcess)]```. From 04a793a56a80696e2bd03b67aa7c3c97a8ee3fbf Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:56 +0000 Subject: [PATCH 11/35] Adding note about ANSI expressions --- docs/Set-RegEx.md | 94 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 73 insertions(+), 21 deletions(-) diff --git a/docs/Set-RegEx.md b/docs/Set-RegEx.md index 44ac217..32d01ba 100644 --- a/docs/Set-RegEx.md +++ b/docs/Set-RegEx.md @@ -12,6 +12,9 @@ Sets Regular Expressions to a .regex.txt file --- ### Related Links * [Use-RegEx](Use-RegEx.md) + + + --- ### Examples #### EXAMPLE 1 @@ -28,9 +31,16 @@ The regular expression. -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[String]```|true |1 |true (ByPropertyName)| +> **Type**: ```[String]``` + +> **Required**: true + +> **Position**: 1 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Name** @@ -38,9 +48,16 @@ The name of the regular expression. If not provided, this can be inferred if th -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[String]```|false |2 |true (ByPropertyName)| +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: 2 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Description** @@ -48,9 +65,16 @@ The description -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[String]```|false |named |true (ByPropertyName)| +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Path** @@ -58,9 +82,16 @@ The path to the file. If this is not provided, it will save regular expressions -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[String]```|false |named |true (ByPropertyName)| +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Temporary** @@ -69,9 +100,16 @@ To use the alias immediately, call Set-RegEx with the . operator (e.g. . Set-Reg -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[Switch]```|false |named |true (ByPropertyName)| +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **TimeOut** @@ -81,9 +119,16 @@ By default, this is 5 seconds -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[TimeSpan]```|false |named |false | +> **Type**: ```[TimeSpan]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **PassThru** @@ -93,9 +138,16 @@ Otherwise, will output the created files. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **WhatIf** -WhatIf is an automatic variable that is created when a command has ```[CmdletBinding(SupportsShouldProcess)]```. From 356b3eb4682ba0f6755a8ef8ab7a43f2ea166f8b Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:56 +0000 Subject: [PATCH 12/35] Adding note about ANSI expressions --- docs/Show-RegEx.md | 110 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 86 insertions(+), 24 deletions(-) diff --git a/docs/Show-RegEx.md b/docs/Show-RegEx.md index 8f4b642..4efee3b 100644 --- a/docs/Show-RegEx.md +++ b/docs/Show-RegEx.md @@ -12,7 +12,13 @@ Displays Regular Expressions, with their match output. --- ### Related Links * [Get-Regex](Get-Regex.md) + + + * [Use-Regex](Use-Regex.md) + + + --- ### Examples #### EXAMPLE 1 @@ -28,9 +34,16 @@ The regular expression. If the pattern starts with a saved capture name, it wil -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[String]```|true |1 |true (ByPropertyName)| +> **Type**: ```[String]``` + +> **Required**: true + +> **Position**: 1 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Match** @@ -38,9 +51,16 @@ One or more strings to match. -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|---------------------| -|```[String[]]```|false |2 |true (ByPropertyName)| +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 2 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Remove** @@ -48,9 +68,16 @@ If set, will remove the regular expression matches from the text. -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[Switch]```|false |named |true (ByPropertyName)| +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Replace** @@ -60,9 +87,16 @@ https://docs.microsoft.com/en-us/dotnet/standard/base-types/substitutions-in-reg -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[String]```|false |named |true (ByPropertyName)| +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Transform** @@ -72,9 +106,16 @@ https://docs.microsoft.com/en-us/dotnet/standard/base-types/substitutions-in-reg -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[String]```|false |named |true (ByPropertyName)| +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Option** @@ -99,9 +140,16 @@ Valid Values: -|Type |Requried|Postion|PipelineInput | -|--------------------|--------|-------|---------------------| -|```[RegexOptions]```|false |4 |true (ByPropertyName)| +> **Type**: ```[RegexOptions]``` + +> **Required**: false + +> **Position**: 4 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **CaseSensitive** @@ -109,9 +157,16 @@ Indicates that the cmdlet makes matches case-sensitive. By default, matches are -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[Switch]```|false |named |true (ByPropertyName)| +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Timeout** @@ -119,9 +174,16 @@ The match timeout. By default, one second. -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|---------------------| -|```[TimeSpan]```|false |named |true (ByPropertyName)| +> **Type**: ```[TimeSpan]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByPropertyName) + + + --- ### Outputs Irregular.RegEx.Output From 6ac03ee1ca5f98d4da20645ca371a67f2b7625bf Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:56 +0000 Subject: [PATCH 13/35] Adding note about ANSI expressions --- docs/Use-RegEx.md | 383 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 296 insertions(+), 87 deletions(-) diff --git a/docs/Use-RegEx.md b/docs/Use-RegEx.md index fc013a4..7e520aa 100644 --- a/docs/Use-RegEx.md +++ b/docs/Use-RegEx.md @@ -16,7 +16,13 @@ Use-RegEx is normally called with an alias that is the name of a saved RegEx, fo --- ### Related Links * [Get-RegEx](Get-RegEx.md) + + + * [New-RegEx](New-RegEx.md) + + + --- ### Examples #### EXAMPLE 1 @@ -47,9 +53,16 @@ One or more strings to match. -|Type |Requried|Postion|PipelineInput | -|----------------|--------|-------|---------------------| -|```[String[]]```|false |1 |true (ByPropertyName)| +> **Type**: ```[String[]]``` + +> **Required**: false + +> **Position**: 1 + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **IsMatch** @@ -57,9 +70,16 @@ If set, will return a boolean indicating if the regular expression matched -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Measure** @@ -67,9 +87,16 @@ If set, will measure the number of matches. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Count** @@ -77,9 +104,16 @@ The count of matches to return, or the number of matches split or replaced. -|Type |Requried|Postion|PipelineInput| -|-------------|--------|-------|-------------| -|```[Int32]```|false |named |false | +> **Type**: ```[Int32]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **StartAt** @@ -87,9 +121,16 @@ The starting position of the match -|Type |Requried|Postion|PipelineInput | -|-------------|--------|-------|---------------------| -|```[Int32]```|false |named |true (ByPropertyName)| +> **Type**: ```[Int32]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Remove** @@ -97,9 +138,16 @@ If set, will remove the regular expression matches from the text. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Replace** @@ -109,15 +157,29 @@ https://docs.microsoft.com/en-us/dotnet/standard/base-types/substitutions-in-reg -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Scan** -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **ReplaceIf** @@ -125,9 +187,16 @@ If provided, will replace the match if any of the conditions exist. -|Type |Requried|Postion|PipelineInput| -|-------------------|--------|-------|-------------| -|```[IDictionary]```|false |named |false | +> **Type**: ```[IDictionary]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **ReplaceEvaluator** @@ -136,9 +205,16 @@ The values returned from this script block will replace the match. -|Type |Requried|Postion|PipelineInput| -|-------------------|--------|-------|-------------| -|```[ScriptBlock]```|false |named |false | +> **Type**: ```[ScriptBlock]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Split** @@ -146,9 +222,16 @@ If set, will split the input text according to the expression. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Until** @@ -156,9 +239,16 @@ If set, will get the text until the expression. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **IncludeMatch** @@ -169,9 +259,16 @@ If neither -Split or -Until is provided, this parameter is ignored. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **IncludeInputObject** @@ -179,9 +276,16 @@ If -IncludeInputObject is provided, will add any piped in input object to extrac -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Trim** @@ -189,9 +293,16 @@ If set, will trim returned strings. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Extract** @@ -199,9 +310,16 @@ If set, will extract capture groups into a custom object. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **PSTypeName** @@ -210,9 +328,16 @@ This implies -Extract. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Transform** @@ -222,9 +347,16 @@ https://docs.microsoft.com/en-us/dotnet/standard/base-types/substitutions-in-reg -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[String]```|false |named |false | +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Coerce** @@ -232,9 +364,16 @@ If provided, will cast named capture groups to a given type. This implies -Extr -|Type |Requried|Postion|PipelineInput| -|-------------------|--------|-------|-------------| -|```[IDictionary]```|false |named |false | +> **Type**: ```[IDictionary]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Where** @@ -242,9 +381,16 @@ If provided, will filter the extracted data of a match. -|Type |Requried|Postion|PipelineInput| -|-------------------|--------|-------|-------------| -|```[ScriptBlock]```|false |named |false | +> **Type**: ```[ScriptBlock]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **If** @@ -254,9 +400,16 @@ If the value is a string, it will be treated as a Replacement string (like -Tran -|Type |Requried|Postion|PipelineInput| -|-------------------|--------|-------|-------------| -|```[IDictionary]```|false |named |false | +> **Type**: ```[IDictionary]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Option** @@ -279,9 +432,16 @@ Valid Values: -|Type |Requried|Postion|PipelineInput| -|--------------------|--------|-------|-------------| -|```[RegexOptions]```|false |named |false | +> **Type**: ```[RegexOptions]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **RightToLeft** @@ -289,9 +449,16 @@ If set, will go from right to left, instead of left to right. -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Timeout** @@ -299,9 +466,16 @@ The match timeout. By default, five seconds. -|Type |Requried|Postion|PipelineInput| -|----------------|--------|-------|-------------| -|```[TimeSpan]```|false |named |false | +> **Type**: ```[TimeSpan]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **CaseSensitive** @@ -309,9 +483,16 @@ Indicates that the cmdlet makes matches case-sensitive. By default, matches are -|Type |Requried|Postion|PipelineInput| -|--------------|--------|-------|-------------| -|```[Switch]```|false |named |false | +> **Type**: ```[Switch]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **Pattern** @@ -320,9 +501,16 @@ While we don't want to restrict the steps here, we _do_ want to be able to sugge -|Type |Requried|Postion|PipelineInput | -|--------------|--------|-------|---------------------| -|```[String]```|false |named |true (ByPropertyName)| +> **Type**: ```[String]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:true (ByPropertyName) + + + --- #### **Generator** @@ -330,9 +518,16 @@ A pattern generator. This script will generate a regular expression -|Type |Requried|Postion|PipelineInput| -|-------------------|--------|-------|-------------| -|```[ScriptBlock]```|false |named |false | +> **Type**: ```[ScriptBlock]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **ExpressionParameter** @@ -340,9 +535,16 @@ Named parameters for the regular expression. These are only valid if the regex -|Type |Requried|Postion|PipelineInput| -|-------------------|--------|-------|-------------| -|```[IDictionary]```|false |named |false | +> **Type**: ```[IDictionary]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- #### **ExpressionArgumentList** @@ -350,9 +552,16 @@ A list of arguments. These are only valid if the regex is using a Generator scr -|Type |Requried|Postion|PipelineInput| -|------------------|--------|-------|-------------| -|```[PSObject[]]```|false |named |false | +> **Type**: ```[PSObject[]]``` + +> **Required**: false + +> **Position**: named + +> **PipelineInput**:false + + + --- ### Outputs System.Text.RegularExpressions.Match From fa86b85e5a6576e5adcc615fb6ecc2c8ae4a204a Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:56 +0000 Subject: [PATCH 14/35] Adding note about ANSI expressions --- docs/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/README.md b/docs/README.md index 256a9c1..66575ab 100644 --- a/docs/README.md +++ b/docs/README.md @@ -32,7 +32,7 @@ Once you understand some basics of that syntax, regular expressions become a lot 3. A Regex can have comments! ( # Like this in .NET ( or like (?#this comment) in ECMAScript ) ). 4. You don't have to do it all in one expression! -Irregular comes with 111 useful [named expressions](SavedPatterns.md), and lets you create more. +Irregular comes with 117 useful [named expressions](SavedPatterns.md), and lets you create more. To see the expressions that ship with Irregular, run: @@ -153,5 +153,3 @@ string: 'hello' - - From cad0121c03386a89247aa6c92989bdec15e6455c Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:57 +0000 Subject: [PATCH 15/35] Adding note about ANSI expressions --- docs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.md b/docs/README.md index 66575ab..f6e22d1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -153,3 +153,4 @@ string: 'hello' + From 29fe54c0f30c54c9b36935fec46154350cf9b1a4 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:57 +0000 Subject: [PATCH 16/35] Adding note about ANSI expressions --- docs/SavedPatterns.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/SavedPatterns.md b/docs/SavedPatterns.md index dfeb5d7..97b63ea 100644 --- a/docs/SavedPatterns.md +++ b/docs/SavedPatterns.md @@ -1,7 +1,13 @@ ### Irregular Patterns -Irregular includes 111 regular expressions +Irregular includes 117 regular expressions |Name|Description|IsGenerator| |:---|:----------|:----------| +|[ANSI_24BitColor](/RegEx/ANSI/24BitColor.regex.txt)|Matches an ANSI 24-bit color|False| +|[ANSI_4BitColor](/RegEx/ANSI/4BitColor.regex.txt)|Matches an ANSI 3 or 4-bit color|False| +|[ANSI_8BitColor](/RegEx/ANSI/8BitColor.regex.txt)|Matches an ANSI 8 bit color|False| +|[ANSI_Color](/RegEx/ANSI/Color.regex.txt)|Matches an ANSI color|False| +|[ANSI_DefaultColor](/RegEx/ANSI/DefaultColor.regex.txt)|Matches an ANSI 24-bit color|False| +|[ANSI_Sequence](/RegEx/ANSI/Sequence.regex.txt)|Matches an ANSI escape code|False| |[ArithmeticOperator](/RegEx/ArithmeticOperator.regex.txt)|Simple Arithmetic Operators|False| |[BalancedBrackets](/RegEx/BalancedBrackets.regex.txt)|Matches content in brackets, as long as it is balanced|False| |[BalancedCode](/RegEx/BalancedCode.regex.ps1)|Matches code balanced by a [, {, or (|True| From 4b9eef87b8e3f853f06c860f2a42664a6820d191 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:29:57 +0000 Subject: [PATCH 17/35] Adding note about ANSI expressions --- docs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.md b/docs/README.md index f6e22d1..07e1d9f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -154,3 +154,4 @@ string: 'hello' + From 0557a3643a477473a6128037a4a3d2745a366018 Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Sun, 11 Sep 2022 20:31:02 -0700 Subject: [PATCH 18/35] New-Regex: Not escaping underscores (Fixes #122) --- New-RegEx.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/New-RegEx.ps1 b/New-RegEx.ps1 index 8ed34e6..ae152ab 100644 --- a/New-RegEx.ps1 +++ b/New-RegEx.ps1 @@ -684,7 +684,7 @@ $ccLookup[$notcc] }) - $lc = @($literalCharacter -replace '[\p{P}\p{S}]', '\$0') + $lc = @($literalCharacter -replace '[\p{P}\p{S}-[_]]', '\$0') $notLC = @($ExcludeliteralCharacter -replace '[\p{P}\p{S}]', '\$0') $charSet = @( From 0bf55db777f22c72b61878bf568c5dc28f2a6da7 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:31:44 +0000 Subject: [PATCH 19/35] New-Regex: Not escaping underscores (Fixes #122) --- docs/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 07e1d9f..66575ab 100644 --- a/docs/README.md +++ b/docs/README.md @@ -153,5 +153,3 @@ string: 'hello' - - From 3b41961ff30f45e88c98206053374c01d9c44106 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:31:44 +0000 Subject: [PATCH 20/35] New-Regex: Not escaping underscores (Fixes #122) --- docs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.md b/docs/README.md index 66575ab..f6e22d1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -153,3 +153,4 @@ string: 'hello' + From 6886b25070f0854d11fd64c8df1d7c82c4b4e18b Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:31:44 +0000 Subject: [PATCH 21/35] New-Regex: Not escaping underscores (Fixes #122) --- docs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.md b/docs/README.md index f6e22d1..07e1d9f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -154,3 +154,4 @@ string: 'hello' + From f5de934b57d1df67da9673c2ce58b57015036a18 Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Sun, 11 Sep 2022 20:39:11 -0700 Subject: [PATCH 22/35] Updating workflow (excluding .gif from publish) (Fixes #118) --- .github/workflows/IrregularTests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/IrregularTests.yml b/.github/workflows/IrregularTests.yml index 4366d54..373bf27 100644 --- a/.github/workflows/IrregularTests.yml +++ b/.github/workflows/IrregularTests.yml @@ -419,7 +419,7 @@ jobs: $ModulePath, [string[]] - $Exclude = @('*.png', '*.mp4', '*.jpg','*.jpeg') + $Exclude = @('*.png', '*.mp4', '*.jpg','*.jpeg', '*.gif') ) $gitHubEvent = if ($env:GITHUB_EVENT_PATH) { @@ -427,7 +427,7 @@ jobs: } else { $null } if (-not $Exclude) { - $Exclude = @('*.png', '*.mp4', '*.jpg','*.jpeg') + $Exclude = @('*.png', '*.mp4', '*.jpg','*.jpeg', '*.gif') } From 0e9183f3e53f0ca1df749db577312c0ebf917220 Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Sun, 11 Sep 2022 20:41:53 -0700 Subject: [PATCH 23/35] Adding ? (Fixes #121) --- RegEx/Mustache/README.ps1.md | 15 ++++++++++ RegEx/Mustache/Tag.regex.ps1 | 54 ++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 RegEx/Mustache/README.ps1.md create mode 100644 RegEx/Mustache/Tag.regex.ps1 diff --git a/RegEx/Mustache/README.ps1.md b/RegEx/Mustache/README.ps1.md new file mode 100644 index 0000000..a89aea7 --- /dev/null +++ b/RegEx/Mustache/README.ps1.md @@ -0,0 +1,15 @@ +This directory contains regular expressions for [Mustache templates](http://mustache.github.io/). + + +~~~PipeScript{ + Import-Module ../../Irregular.psd1 -Global + $directoryName = $pwd | Split-Path -Leaf + [PSCustomObject]@{ + Table = Get-Regex -Name "${directoryName}_*" | + Sort-Object Name | + Select @{ + Name='Name' + Expression={"[?<$($_.Name)>]($($_.Path | Split-Path -Leaf))"} + }, Description, IsGenerator + }} +~~~ \ No newline at end of file diff --git a/RegEx/Mustache/Tag.regex.ps1 b/RegEx/Mustache/Tag.regex.ps1 new file mode 100644 index 0000000..000eb08 --- /dev/null +++ b/RegEx/Mustache/Tag.regex.ps1 @@ -0,0 +1,54 @@ +param( +[string] +$Tag, + +[ValidateSet('Comment','Escaped','SectionStart','SectionEnd', 'Partial', 'Unescaped')] +[string[]] +$TagType +) + +if (-not $tag) { + $tag = @" +(?:.|\s){0,}?(?=\z| # Now we match everything until +(?(IsEscaped)(\}{3})|(\}{2})) # 3 Brackets (if escaped) 2 (if not) +) +"@ +} + +$mustBeType = $true + +$tagTypeRegex = [Ordered]@{ + "Escaped" = "\{", "# One more curly bracket marks it as escaped." + "SectionStart" = "\#", "# Starting with a number sign makes it a section start." + "SectionEnd" = "\/", "# Starting with a slash makes it a section end." + "Comment" = "\!", "# Starting with an exclamation point makes it a comment." + "Partial" = "\>", "# Starting with greater than makes it a partial" + "Unescaped" = "\&", "# Unescaped variables start with ampersands." +} + +if (-not $TagType) { + $TagType = $TagTypeRegex.Keys + $mustBeType = $false +} +$ValidTagTypes = + @(foreach ($tt in $tagTypeRegex.GetEnumerator()) { + @( + $tt.Value[1] + "(?>$($tt.Value[0]))" + ) -join [Environment]::NewLine + }) -join ([Environment]::NewLine + '|' + [Environment]::NewLine) + +$ValidTagTypes = "(?> +$ValidTagTypes + +)$(if (-not $mustBeType) { '?' })" +" +\{{2} # Two curly brackets start a tag +$ValidTagTypes +\s{0,} +(? +$tag +) +# Once more, to be sure we're not at the end of the document. +(?(IsEscaped)(\}{3})|(\}{2})) # 3 Brackets (if escaped) 2 (if not) +" \ No newline at end of file From 58dd0c3d828cade72aa4932ba11139fabb356763 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:42:16 +0000 Subject: [PATCH 24/35] Updating SavedPatterns.md [skip ci] --- SavedPatterns.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SavedPatterns.md b/SavedPatterns.md index f26d350..a0847c9 100644 --- a/SavedPatterns.md +++ b/SavedPatterns.md @@ -1,5 +1,5 @@ ### Irregular Patterns -Irregular includes 117 regular expressions +Irregular includes 118 regular expressions |Name|Description|IsGenerator| |:---|:----------|:----------| |[ANSI_24BitColor](/RegEx/ANSI/24BitColor.regex.txt)|Matches an ANSI 24-bit color|False| @@ -73,6 +73,7 @@ Irregular includes 117 regular expressions |[Markdown_ThematicBreak](/RegEx/Markdown/ThematicBreak.regex.txt)|Matches markdown horizontal rules|False| |[Markdown_YAMLHeader](/RegEx/Markdown/YAMLHeader.regex.txt)|Matches a Markdown YAML Header|False| |[MultilineComment](/RegEx/MultilineComment.regex.ps1)|Matches Multline Comments from a variety of languages.
Currently supported: PowerShell, C#, C++, JavaScript, Ruby, HTML, and XML
When this generator is used with a piped in file, the extension will autodetect the format.
If the format could not be autodetected, the match will always fail.|True| +|[Mustache_Tag](/RegEx/Mustache/Tag.regex.ps1)||True| |[Network_IPv4Address](/RegEx/Network/IPv4Address.regex.txt)|Matches an IPv4 Address|False| |[Network_MACAddress](/RegEx/Network/MACAddress.regex.txt)|Matches a MAC address|False| |[NewLine](/RegEx/NewLine.regex.txt)|A newline (in either Windows (\r\n) or Unix (\n) form)|False| From c4bb2505d5d5a9b7839502850e08f14bbbf808d1 Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Sun, 11 Sep 2022 20:45:14 -0700 Subject: [PATCH 25/35] Renaming ? to ? --- RegEx/ANSI/{Sequence.regex.source.ps1 => Code.regex.source.ps1} | 0 RegEx/ANSI/{Sequence.regex.txt => Code.regex.txt} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename RegEx/ANSI/{Sequence.regex.source.ps1 => Code.regex.source.ps1} (100%) rename RegEx/ANSI/{Sequence.regex.txt => Code.regex.txt} (100%) diff --git a/RegEx/ANSI/Sequence.regex.source.ps1 b/RegEx/ANSI/Code.regex.source.ps1 similarity index 100% rename from RegEx/ANSI/Sequence.regex.source.ps1 rename to RegEx/ANSI/Code.regex.source.ps1 diff --git a/RegEx/ANSI/Sequence.regex.txt b/RegEx/ANSI/Code.regex.txt similarity index 100% rename from RegEx/ANSI/Sequence.regex.txt rename to RegEx/ANSI/Code.regex.txt From 6a6b70e0e308c2b55ff3b4cad77fab065084facd Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:45:34 +0000 Subject: [PATCH 26/35] Updating SavedPatterns.md [skip ci] --- SavedPatterns.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SavedPatterns.md b/SavedPatterns.md index a0847c9..93bd9ea 100644 --- a/SavedPatterns.md +++ b/SavedPatterns.md @@ -5,9 +5,9 @@ Irregular includes 118 regular expressions |[ANSI_24BitColor](/RegEx/ANSI/24BitColor.regex.txt)|Matches an ANSI 24-bit color|False| |[ANSI_4BitColor](/RegEx/ANSI/4BitColor.regex.txt)|Matches an ANSI 3 or 4-bit color|False| |[ANSI_8BitColor](/RegEx/ANSI/8BitColor.regex.txt)|Matches an ANSI 8 bit color|False| +|[ANSI_Code](/RegEx/ANSI/Code.regex.txt)|Matches an ANSI escape code|False| |[ANSI_Color](/RegEx/ANSI/Color.regex.txt)|Matches an ANSI color|False| |[ANSI_DefaultColor](/RegEx/ANSI/DefaultColor.regex.txt)|Matches an ANSI 24-bit color|False| -|[ANSI_Sequence](/RegEx/ANSI/Sequence.regex.txt)|Matches an ANSI escape code|False| |[ArithmeticOperator](/RegEx/ArithmeticOperator.regex.txt)|Simple Arithmetic Operators|False| |[BalancedBrackets](/RegEx/BalancedBrackets.regex.txt)|Matches content in brackets, as long as it is balanced|False| |[BalancedCode](/RegEx/BalancedCode.regex.ps1)|Matches code balanced by a [, {, or (|True| From 150f2492469536e08abe9496779bf56aba848d13 Mon Sep 17 00:00:00 2001 From: James Brundage <@github.com> Date: Sun, 11 Sep 2022 20:47:23 -0700 Subject: [PATCH 27/35] Updating Module Version [0.7.0] and CHANGELOG --- CHANGELOG.md | 17 ++++++++++++++++- Irregular.psd1 | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c51deb9..aa26f34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,19 @@ -## 0.6.9: +## 0.7.0: +* New Patterns: + * ANSI + * ? (Fixes #123) + * ? (Fixes #124) + * ? + * ? + * ? + * ? + * Mustache + * ? (Fixes #121) +* New-Regex -LiteralCharacter '_' no longer escapes (Fixes #122) +* Reducing module size (excluding assets) (Fixes #118) +--- + +## 0.6.9: * Adding ? (Fixes #117) * GitHub Action now prefers local bits (Fixes #111) * Using PipeScript to enhance the repository experience (Fixes #119) diff --git a/Irregular.psd1 b/Irregular.psd1 index 70dbaf1..c50dd76 100644 --- a/Irregular.psd1 +++ b/Irregular.psd1 @@ -1,5 +1,5 @@ @{ - ModuleVersion = '0.6.9' + ModuleVersion = '0.7.0' RootModule = 'Irregular.psm1' Description = 'Regular Expressions made Strangely Simple' FormatsToProcess = 'Irregular.format.ps1xml' @@ -14,6 +14,21 @@ LicenseURI = 'https://github.com/StartAutomating/Irregular/blob/master/LICENSE' IconURI = 'https://github.com/StartAutomating/Irregular/blob/master/Assets/Irregular_600_Square.png' ReleaseNotes = @' +## 0.7.0: +* New Patterns: + * ANSI + * ? (Fixes #123) + * ? (Fixes #124) + * ? + * ? + * ? + * ? + * Mustache + * ? (Fixes #121) +* New-Regex -LiteralCharacter '_' no longer escapes (Fixes #122) +* Reducing module size (excluding assets) (Fixes #118) +--- + ## 0.6.9: * Adding ? (Fixes #117) * GitHub Action now prefers local bits (Fixes #111) From da3380ea347990d544736cdf7759b3a5989087bf Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:48:14 +0000 Subject: [PATCH 28/35] Updating Module Version [0.7.0] and CHANGELOG --- RegEx/Mustache/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 RegEx/Mustache/README.md diff --git a/RegEx/Mustache/README.md b/RegEx/Mustache/README.md new file mode 100644 index 0000000..ab4de5e --- /dev/null +++ b/RegEx/Mustache/README.md @@ -0,0 +1,9 @@ +This directory contains regular expressions for [Mustache templates](http://mustache.github.io/). + + + +|Name |Description|IsGenerator| +|--------------------------------|-----------|-----------| +|[?](Tag.regex.ps1)|True | + + From d4677cd965cb1f12fa26bb9d50339534c931794a Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:48:14 +0000 Subject: [PATCH 29/35] Updating Module Version [0.7.0] and CHANGELOG --- RegEx/ANSI/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RegEx/ANSI/README.md b/RegEx/ANSI/README.md index 6df70f3..5cc2fba 100644 --- a/RegEx/ANSI/README.md +++ b/RegEx/ANSI/README.md @@ -8,8 +8,8 @@ Note: Using these regular expressions in the terminal may result in awkward out |[?](24BitColor.regex.txt) |Matches an ANSI 24-bit color |False | |[?](4BitColor.regex.txt) |Matches an ANSI 3 or 4-bit color|False | |[?](8BitColor.regex.txt) |Matches an ANSI 8 bit color |False | +|[?](Code.regex.txt) |Matches an ANSI escape code |False | |[?](Color.regex.txt) |Matches an ANSI color |False | |[?](DefaultColor.regex.txt)|Matches an ANSI 24-bit color |False | -|[?](Sequence.regex.txt) |Matches an ANSI escape code |False | From ced020e8534d0a35b2463b3fe279e71af15745ac Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:48:14 +0000 Subject: [PATCH 30/35] Updating Module Version [0.7.0] and CHANGELOG --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b1184bd..b4e7de8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

Regular Expressions made Strangely Simple

A PowerShell module that helps you understand, use, and build Regular Expressions.

-v 0.6.9 +v 0.7.0

@@ -32,7 +32,7 @@ Once you understand some basics of that syntax, regular expressions become a lot 3. A Regex can have comments! ( # Like this in .NET ( or like (?#this comment) in ECMAScript ) ). 4. You don't have to do it all in one expression! -Irregular comes with 117 useful [named expressions](SavedPatterns.md), and lets you create more. +Irregular comes with 118 useful [named expressions](SavedPatterns.md), and lets you create more. To see the expressions that ship with Irregular, run: From 3dab12a2cdf511d8eebc90cdc07370427eb75215 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:48:23 +0000 Subject: [PATCH 31/35] Updating Module Version [0.7.0] and CHANGELOG --- docs/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index 07e1d9f..c91b65f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,7 +3,7 @@

Regular Expressions made Strangely Simple

A PowerShell module that helps you understand, use, and build Regular Expressions.

-v 0.6.9 +v 0.7.0

@@ -32,7 +32,7 @@ Once you understand some basics of that syntax, regular expressions become a lot 3. A Regex can have comments! ( # Like this in .NET ( or like (?#this comment) in ECMAScript ) ). 4. You don't have to do it all in one expression! -Irregular comes with 117 useful [named expressions](SavedPatterns.md), and lets you create more. +Irregular comes with 118 useful [named expressions](SavedPatterns.md), and lets you create more. To see the expressions that ship with Irregular, run: @@ -153,5 +153,3 @@ string: 'hello' - - From d06ee86c16e68b90f503606389a64f88aa735ca7 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:48:23 +0000 Subject: [PATCH 32/35] Updating Module Version [0.7.0] and CHANGELOG --- docs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.md b/docs/README.md index c91b65f..cb12938 100644 --- a/docs/README.md +++ b/docs/README.md @@ -153,3 +153,4 @@ string: 'hello' + From cde25b67d92155bad9f0fed03e7daa9c9b1288da Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:48:23 +0000 Subject: [PATCH 33/35] Updating Module Version [0.7.0] and CHANGELOG --- docs/SavedPatterns.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/SavedPatterns.md b/docs/SavedPatterns.md index 97b63ea..5ca9585 100644 --- a/docs/SavedPatterns.md +++ b/docs/SavedPatterns.md @@ -1,13 +1,13 @@ ### Irregular Patterns -Irregular includes 117 regular expressions +Irregular includes 118 regular expressions |Name|Description|IsGenerator| |:---|:----------|:----------| |[ANSI_24BitColor](/RegEx/ANSI/24BitColor.regex.txt)|Matches an ANSI 24-bit color|False| |[ANSI_4BitColor](/RegEx/ANSI/4BitColor.regex.txt)|Matches an ANSI 3 or 4-bit color|False| |[ANSI_8BitColor](/RegEx/ANSI/8BitColor.regex.txt)|Matches an ANSI 8 bit color|False| +|[ANSI_Code](/RegEx/ANSI/Code.regex.txt)|Matches an ANSI escape code|False| |[ANSI_Color](/RegEx/ANSI/Color.regex.txt)|Matches an ANSI color|False| |[ANSI_DefaultColor](/RegEx/ANSI/DefaultColor.regex.txt)|Matches an ANSI 24-bit color|False| -|[ANSI_Sequence](/RegEx/ANSI/Sequence.regex.txt)|Matches an ANSI escape code|False| |[ArithmeticOperator](/RegEx/ArithmeticOperator.regex.txt)|Simple Arithmetic Operators|False| |[BalancedBrackets](/RegEx/BalancedBrackets.regex.txt)|Matches content in brackets, as long as it is balanced|False| |[BalancedCode](/RegEx/BalancedCode.regex.ps1)|Matches code balanced by a [, {, or (|True| @@ -73,6 +73,7 @@ Irregular includes 117 regular expressions |[Markdown_ThematicBreak](/RegEx/Markdown/ThematicBreak.regex.txt)|Matches markdown horizontal rules|False| |[Markdown_YAMLHeader](/RegEx/Markdown/YAMLHeader.regex.txt)|Matches a Markdown YAML Header|False| |[MultilineComment](/RegEx/MultilineComment.regex.ps1)|Matches Multline Comments from a variety of languages.
Currently supported: PowerShell, C#, C++, JavaScript, Ruby, HTML, and XML
When this generator is used with a piped in file, the extension will autodetect the format.
If the format could not be autodetected, the match will always fail.|True| +|[Mustache_Tag](/RegEx/Mustache/Tag.regex.ps1)||True| |[Network_IPv4Address](/RegEx/Network/IPv4Address.regex.txt)|Matches an IPv4 Address|False| |[Network_MACAddress](/RegEx/Network/MACAddress.regex.txt)|Matches a MAC address|False| |[NewLine](/RegEx/NewLine.regex.txt)|A newline (in either Windows (\r\n) or Unix (\n) form)|False| From f6db2fe8e34a1b77e8bc819f56c2a9e659ea7f38 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:48:24 +0000 Subject: [PATCH 34/35] Updating Module Version [0.7.0] and CHANGELOG --- docs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.md b/docs/README.md index cb12938..36848da 100644 --- a/docs/README.md +++ b/docs/README.md @@ -154,3 +154,4 @@ string: 'hello' + From a1811cc46ba55b3ca357d19994d6f611b75ab681 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Mon, 12 Sep 2022 03:48:24 +0000 Subject: [PATCH 35/35] Updating Module Version [0.7.0] and CHANGELOG --- docs/CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index a33f80c..ae8d8af 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,18 @@ +## 0.7.0: +* New Patterns: + * ANSI + * ? (Fixes #123) + * ? (Fixes #124) + * ? + * ? + * ? + * ? + * Mustache + * ? (Fixes #121) +* New-Regex -LiteralCharacter '_' no longer escapes (Fixes #122) +* Reducing module size (excluding assets) (Fixes #118) +--- + ## 0.6.9: * Adding ? (Fixes #117) * GitHub Action now prefers local bits (Fixes #111)