Book Image

Mastering Windows PowerShell Scripting

By : Brenton J.W. Blawat
Book Image

Mastering Windows PowerShell Scripting

By: Brenton J.W. Blawat

Overview of this book

Table of Contents (22 chapters)
Mastering Windows PowerShell Scripting
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Regular expression quantifiers


When you are writing regular expressions, there are instances where you need to validate if one or more characters exist in the string being evaluated. Regular expression quantifiers evaluate a string to determine if it has a certain number of characters. In the instance of the string ABC, you can write a quantifier expression to evaluate that the string has at least one A, one B, one C, and no D. If the expression has the designated number of characters, it will evaluate as True. If the expression contains less or more than the designated amount, it will return as False.

The regular expression quantifiers include the following characters:

  • *: This character requires zero or more matches of the preceding character to be True. This means that if you specify abc*d, it will match a, b and then zero or more of c followed by the letter d. In the instance of aaabbbbccccd, the string will evaluate to be True because the letters a, b, and c are in the exact order before...