Skip to content

Instantly share code, notes, and snippets.

@cdhunt
Created January 5, 2016 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdhunt/9e0d46d07c3690f69448 to your computer and use it in GitHub Desktop.
Save cdhunt/9e0d46d07c3690f69448 to your computer and use it in GitHub Desktop.
Messing around with CSharpVerbalExpressions and Fluent API in Powershell
Add-Type -Path C:\Temp\CSharpVerbalExpressions-master\VerbalExpressions\bin\Release\VerbalExpressions.dll
[psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::add("verbex", "CSharpVerbalExpressions.VerbalExpressions")
[verbex]::new().StartOfLine().Then("http").Maybe("s").Then("://").Maybe("www.").AnythingBut(" ").EndOfLine().Test("https://www.google.com")
$proto = [verbex]::new().StartOfLine().Then("http").Maybe("s").Then("://")
$Uri = $proto.AnythingBut(" ").EndOfLine()
$uri
$uri.Test("http://google.com")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment