Need regEx help

To quickly learn regex I keep following top sites in my bookmarks:

Regex general:
Regex Cheat Sheet (rexegg.com)
Regular Expressions Quick Start (regular-expressions.info)

Regex .NET (Most useful for PS scripting):
Regular Expression Language - Quick Reference | Microsoft Docs

See also following to understand difference between regex usage in PS:
Powershell: The many ways to use regex (powershellexplained.com)

.NET regex class reference is best way to learn additional regex functionality that works in PS:
Regex Class (System.Text.RegularExpressions) | Microsoft Docs

Quick online regex tests:
RegExr: Learn, Build, & Test RegEx
Regex tester (rextester.com)
Online Regex tester and visualizer - Python, PHP, Ruby, JavaScript, Java (extendsclass.com)

Good way to practice regex is to use regex patterns in VSCode to highlight source code interactively, but keep in mind that VSCode regex box works slightly different than when you write it inline (in code), this means you need to convert it after constructing pattern.

2 Likes

Thank you Metablaster :slight_smile:

Well KrzyDoug … Once I tried your RegEX in the actual production script, it is not having any affect when the value between the TH tags contains a space. Is that an easy fix?

As an example:

'<tr><th>UNC Path to Log</th><th>Link to Log File</th><th>Investigate</th></tr>'

The only value affected the the RegEX would be ‘Investigate’
Sorry to bother you again Doug.

Yeah change \S+? to .+?

Perfect, thank you sir :slight_smile: