Irregular.types.ps1xml

<?xml version="1.0" encoding="utf-16"?>
<Types>
  <Type>
    <Name>Irregular.Regular.Expression</Name>
    <Members>
      <ScriptProperty>
        <Name>GroupNames</Name>
        <GetScriptBlock>
                    
            if ($this -is [Regex]) {
                $this.GetGroupNames()
            }
            else { @() }
        
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Pattern</Name>
        <GetScriptBlock>
                     $this.ToString()
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>IsValid</Name>
        <GetScriptBlock>
                     if ($this -is [Regex]) { $true } else { $false }
                </GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>Irregular.Match.Extract</Name>
    <Members>
      <ScriptProperty IsHidden="true">
        <Name>Input</Name>
        <GetScriptBlock>
                     $this.Match.Result('$_')
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty IsHidden="true">
        <Name>StartIndex</Name>
        <GetScriptBlock>
                     $this.Match.Index
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty IsHidden="true">
        <Name>EndIndex</Name>
        <GetScriptBlock>
                     $this.Match.Index + $this.Match.Length
                </GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
  <Type>
    <Name>System.Text.RegularExpressions.Match</Name>
    <Members>
      <ScriptMethod>
        <Name>Peek</Name>
        <Script>
                    param([int]$Length = 1)
            if ($Length -gt 0) {
                if ($this.After.Length -gt $Length) {
                    $this.After.Substring(0,$Length)
                } elseif ($this.After) {
                    $this.After.Substring(0)
                }
            } elseif ($Length -lt 0) {
                $Length *= -1
                if ($this.Before.Length -gt $Length) {
                    $this.Before.Substring($this.Before.Length - $Length)
                } elseif ($this.Before) {
                    $this.Before
                }
            }
        
                </Script>
      </ScriptMethod>
      <ScriptProperty>
        <Name>Line</Name>
        <GetScriptBlock>
                     
            [Regex]::new('(?&gt;\r\n|\n|\A)', 'RightToLeft').Matches($this.Input, $this.Index).Count
        
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>EndIndex</Name>
        <GetScriptBlock>
                     $this.Index + $this.Length
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>After</Name>
        <GetScriptBlock>
                     $this.Result('$''')
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Before</Name>
        <GetScriptBlock>
                     $this.Result('$`')
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Column</Name>
        <GetScriptBlock>
                    
            $this.Index -
                $(
                    $m = [Regex]::new('(?&gt;\r\n|\n|\A)', 'RightToLeft').Match($this.Input, $this.Index)
                    $m.Index + $m.Length
                ) + 1
        
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>Input</Name>
        <GetScriptBlock>
                     $this.Result('$_')
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>LastGroup</Name>
        <GetScriptBlock>
                     $this.Result('$+')
                </GetScriptBlock>
      </ScriptProperty>
      <ScriptProperty>
        <Name>StartIndex</Name>
        <GetScriptBlock>
                     $this.Index
                </GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
</Types>