Need help with trimming Out and store into a variable

Hi All,

I need a powershell to read the text and trim the output from a starting and ending character\symbol or pattern and store the trimmed Value into a Variable which can be used for parsing the value in a loop for further actions.

Ex - text with the output lines and needs to be trimmed
Appl: Evaluating package applicability for package Microsoft-Windows-LanguageFeatures-Basic-af-za-Package~31bf3856ad364e35~amd64~~10.0.19041.1, applicable state: Installed

Required String After Trimming -
Microsoft-Windows-LanguageFeatures-Basic-af-za-Package~31bf3856ad364e35~amd64~~10.0.19041.1

Rdugar,
Welcome to the forum. :wave:t3:

This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

We actually expect you to make an own attempt at the first place to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

Next …

When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in PowerShell.org 1 <---- Click :point_up_2:t4: :wink:

( !! Sometimes the preformatted text button hides behind the settings gear symbol. :wink: )

Where do you get this text from? It looks like the output of another script or application and it might be easier to get the desired output in the first place instead of tinkering with string acrobatics later on. :man_shrugging:t3: