2016-March Scripting Games Wrap-Up

Carlo really put a brain-twister out for our March 2016 Puzzle. Also, as a note, we're eagerly awaiting submissions of next month's puzzle, so don't delay in handing that in. Here's how you can contribute to the community's favorite scripting game.

Official Solution

It's probably easiest just to share his solutions as actual script files, so here's both the Beginner and Advanced versions that he provided, as a ZIP:


Carlo also provided some notes on his thinking:

Just a precision concerning the regex: the idea I had was to 'force' competitors to think in terms of Unicode categories and block ranges (unknown concept to most I bet).

Without digging, some people could come up with an expression like this, which is NOT what we want:

[char]$_ -match '[^\x20-\x7E]'

My idea is to force inclusion of latin chars (hence {IsLatin-1Supplement}) which are letters {L}, then progressively exclude all numbers {N}, all punctuation characters {P}, all symbols {S} and all separators {Z}.

A proper use of the \p (in lowercase) and \P (in uppercase) constructs to force inclusion and exclusion is essential here:

[char]$_ -match "(?=\p{IsLatin-1Supplement})(?=\p{L})(?=\P{N})(?=\P{P})(?=\P{S})(?=\P{Z})")

Did you follow his thinking? How's you do?

Posted in:
About the Author

Don Jones

Profile photo of Don Jones

Don Jones is a Windows PowerShell MVP, author of several Windows PowerShell books (and other IT books), Co-founder and President/CEO of PowerShell.org, PowerShell columnist for Microsoft TechNet Magazine, PowerShell educator, and designer/author of several Windows PowerShell courses (including Microsoft's). Power to the shell!