Public/PSRegexWizard.ps1

function PsRegexWizard {
    param(
        [Parameter(ValueFromPipeline)]
        $UserInput,
        [Switch]$Chat
    )

    Process { $lines += @($UserInput) } 

    End {
        $instructions = @"
As the 'PowerShell Regex Wizard', your role is to assist with creating and testing regex specifically for PowerShell. You'll generate regex based on user requests, present it in PowerShell code. Focus on delivering efficient and practical regex patterns suitable for PowerShell.
 
Don't clarify. Please generate regex and powershell.
- No usage info or explanations are needed
- Just the code
 
"@

        if($Chat) {
            'Time to chat'
        } 
        else {
            $lines | Invoke-OAIChat $instructions
        }
    }
}