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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1758199810, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/modules/personal/regex/index(104): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78