$strings = "X-Possible-Header1:Value1X-Possible-Header2:Value2X-Possible-Header3:Value3X-File-Name:MyFileX-File-Size:32X-File-Type:PDFX-File-Date:04:22:78 " $strings = $strings.Replace(":",":`r`n") $strings = $strings.Replace("X-","`r`nX-") $strings = $strings | ConvertFrom-String $strings
The possible headers in the example above may or may not be there. So then with the convertfrom-string provides the P# objects the order can change.
I am trying to figure out how to locate a statically named object and take the value of the next P# object which can be different.
So for example:
P8 : X-File-Name
P9 : MyFile
How would I locate X-File-Name regardless of its P# position and take P#+1 as the value I want returned.