Skip to content

Instantly share code, notes, and snippets.

View Agazoth's full-sized avatar

Axel B. Andersen Agazoth

View GitHub Profile
@IISResetMe
IISResetMe / ConvertTo-Object.ps1
Last active July 25, 2023 23:12
Quick and dirty regex-based text-to-object parsing using named expressions groups and $Matches
function ConvertTo-Object {
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[AllowEmptyString()]
[string[]]$InputString,
[Parameter(Mandatory=$true,ValueFromRemainingArguments=$true)]
[string[]]$Pattern
)