Friday, November 2, 2018

RegEx Testing Tools

One of the websites I use most is regex101. It is a great place to test your RegEx against text you provide. You can provide sample text, define your expression, then see the substitution results. What's more, you can login and save your expressions for future use. I used this feature in the past for Rexx scripts. We had a file cleanup section in each script. Rather than re-writing the delete line with each file, I would do a Get-ChildItem, and take out the file info, as so. Which leads to another nice feature; if you save an expression, you can share it with a link. Lastly, you can generate code for your expression in javascript, python, php, c#, and several other languages.

It does not, however, do Powershell...

Luckily I found another; regexhero, which is purely for Powershell regular expressions. I have just started using this for a fairly simple -replace line I was writing. regexhero will do -match, -replace, and -split functions where you provide your target string and expression to run against it.

Sadly, regexhero uses Microsoft Silverlight and reportedly only works on Internet Explorer 9+, so Linux users are left out. So too, apparently, are Microsoft Edge users (though it is possible Silverlight is not properly configured on my Edge browser). The web developer in me would like the site to be more universally available, but is also intrigued by the use of Silverlight.

Now, if I could find a way to look at the peculiarities of vi regex...

No comments: