Working with strings in PowerShell

PowerShell, as a language, is known for its object-oriented approach. Yet a lot of commands within the language and its .NET support still allow the user to massage and manipulate text (strings) in some ways.

When working with strings in PowerShell, we’ve got lots of options depending on what we’re trying to accomplish. We’ve got ways to find text within the text, edit text, and add text. Each of these categories entails some different commands and techniques.

For this article, we’ll touch on finding text and adding text. More specifically, let’s go over how to use simple string matching and regular expressions (regex) as well as appending strings to existing object properties. To keep it simple, we’ll hold everything in memory here, so we won’t be going over how to write this text to files or pull text from a database, for example.

Read the full article at 4Sysops

Leave a Reply