Created
January 5, 2016 15:04
-
-
Save cdhunt/9e0d46d07c3690f69448 to your computer and use it in GitHub Desktop.
Messing around with CSharpVerbalExpressions and Fluent API in Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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