Skip to content

Instantly share code, notes, and snippets.

View NicoNekoru's full-sized avatar
🥔

NicoNekoru

🥔
View GitHub Profile
function Invoke-RegexTerror
{
[CmdletBinding(DefaultParameterSetName = 'ToBeOrNotToBe')]
param(
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[int]$Count,
[Parameter(ParameterSetName = 'ToBeOrNotToBe')]
[switch]$Shakespeare,
@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
)