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 anchors


Anchors are used to tell the regular expression where to start and end the evaluation of a string. The most common anchors evaluate the characters at the beginning or the end of a string. This allows you to validate that the string starts and/or ends with a digit, symbol, or letter character. The most common anchors are:

  • ^ and \A: The ^ and \A anchor characters indicates matching at the start of a string for evaluation. If you want to ensure that a certain pattern is matched at the beginning, you will use ^ or \A. The \A syntax is symbolic of the first character in the alphabet which is a. This is why regular expressions use this character to designate the evaluation from the start of a string.

  • $ and \Z: The $ and \Z anchor characters indicate matching at the end of a string for evaluation. If you want to ensure that a certain pattern is matched at the end, you will use $ or \Z. The \Z syntax is symbolic of the last character in the alphabet which is z. This is...