Search notes:

Powershell module: regex

Functions

select-regex

Source code

regex.psm1

set-strictMode -version latest

function select-regex {
    param (
     [parameter(mandatory=$true)]
     [regex] $regex,
   # ----
     [parameter(mandatory         = $true,
                valueFromPipeline = $true)]
     [allowEmptyString()]
     [string] $text
    )

    begin {
       $regex = [regex]::new($regex)
    }

    process {

        $match = $regex.match($text)
        if ($match.success) {
            $match.Groups[0].value
        }
    }

    end {
    }
}
Github repository ps-modules-regex, path: /regex.psm1

regex.psd1

@{
   rootModule         = 'regex.psm1'
   moduleVersion      = '0.1'

   requiredAssemblies = @()
   requiredModules    = @()

   functionsToExport  = @(
     'select-regex'
   )

   aliasesToExport    = @()
}
Github repository ps-modules-regex, path: /regex.psd1

See also

Regular expressions
A script that uses this module is ff.ps1.
René's simple PowerShell modules

Index