Time to Use Regular Expressions More, Um, Regularly by Mark Minasi
Channel: PowerShell.org
Date: 2018-05-04

Text data is a pain. Whether it's checking files for SSNs, verifying that a password is complex enough, or updating every page in your web site, text is a pain. Now, you probably know that "regular expressions" could help, but aren't they really hard? Well, not if Mark Minasi's explaining them.
    Is that a valid email address, or just a SQL injection attack?  Does that folder full of Word files contain any credit card or bank routing numbers?  Does that proposed password meet our requirements?  How can I easily extract just a few important bits of weather data from a page full of raw HTML?  If you've been coding or scripting for any time at all, then you already know the answer -- "regular expressions" or "regexes."  But if you're like most of us, regex is one of those "I'll get around to it one day" things, and while "\d=digit, \s=white space, etc" is relatively easy to learn, regex soon becomes essentially opaque.  ("Isn't that line noise?" is the one of the more polite observations one hears.)
    In this "medium-deep dive,"  award-winning author, teacher and veteran of more text processing debacles than he prefers to remember Mark Minasi shines a light on how regex works and offers tips on how to get the best out of it.  In this session, you'll learn a minimum of regex, which then enables us to get an in-depth knowledge of how the regex "engine" works -- knowledge which is the key to getting anything done in regex.  Then you'll see how PowerShell's regex engine -- which is really .NET's regex engine -- can be configured and how it behaves differently from other regex engines.  (It's astounding how easily you can build an infinite loop with regex, so you're REALLY going to want to know how to set up regex timeouts.) With that out of the way, we'll then cover regex syntax with lots and lots of examples, as well as some nice regex prototyping tools.
     Very few tools in the computing business are as old as regex or as cross-platform, and yet in the domain of text processing virtually nothing exceeds regex's power.  It would, then, be a terrible shame if you didn't have some familiarity with this old friend.  In short, attend this session because Mark "sed" so!
     Now and then, I get the itch to find something that's been around FOREVER, that everyone really, really OUGHT to know -- and they know it, back in that awful "stuff I really should learn one of these days" list we all have -- and make it useful and understandable.