Regular expressions can quickly become complicated and difficult to understand. Modifying a complex regular expression is not a particularly simple undertaking.
While PowerShell indicates if there is a syntax error in a regular expression, it cannot do more than that; for example, PowerShell announces that there is a syntax error in the following expression:
PS> 'abc' -match '*'
parsing "*" - Quantifier {x,y} following nothing.
At line:1 char:1
+ 'abc' -match '*'
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException
Fortunately, there are a number of websites that can visualize a regular expression and lend an understanding of how it works against a string.
Debuggex is one such site; it can pick apart regular expressions, showing how each element applies to an example:
Debuggex uses Java regular expressions; some of the examples used in this chapter may not be compatible.
Online engines that are .NET specific but do not include visualization are as follows:
Finally, the website http://www.regular-expressions.info is an important learning resource that provides detailed descriptions, examples, and references.