This chapter explained the basics of regular expressions and showed how to integrate them with PowerShell. It explained that if you are using regular expressions, you should fully comment on the code to allow other developers to read your expressions easily. This chapter further explained that PowerShell uses the –match
, -cmatch
, and –replace
operators with regular expressions to evaluate criteria for strings. You also saw the most common metacharacters and how to use them in expressions. You also learned how to use grouping constructs, ranges, and qualifiers. This chapter discussed the most common anchors and concluded by providing examples of regular expressions that you may use in your scripts. These examples included a regular expression to validate a MAC address, UNC Path, and an ICANN formatted United States telephone number. In the next chapter, you will explore error and exception handling and find out about techniques for handling errors in your scripts. The next chapter...
Mastering Windows PowerShell Scripting
By :
Mastering Windows PowerShell Scripting
By:
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
Free Chapter
Variables, Arrays, and Hashes
Data Parsing and Manipulation
Comparison Operators
Functions, Switches, and Loops Structures
Regular Expressions
Error and Exception Handling and Testing Code
Session-based Remote Management
Managing Files, Folders, and Registry Items
File, Folder, and Registry Attributes, ACLs, and Properties
Windows Management Instrumentation
XML Manipulation
Managing Microsoft Systems with PowerShell
Automation of the Environment
Script Creation Best Practices and Conclusion
Index
Customer Reviews