# Search multiline string and edit it.

**URL:** <https://forums.powershell.org/t/search-multiline-string-and-edit-it/586>\
**Category:** PowerShell Help\
**Created:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/search-multiline-string-and-edit-it/586 "2011-12-31T18:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![archives](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@archives](https://forums.powershell.org/u/archives)\
**Post date:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/search-multiline-string-and-edit-it/586/1 "2011-12-31T18:30:00Z")

</div>

by OliAdams at 2013-02-10 05:41:54

> This is what is returned when I query backup exec. which is stored in the variable $JobInfo.  
>   
> JOB ID: {1234-123-1234}  
> JOB ID: {1234-123-1223}  
>   
> NUMBER OF OBJECTS: 2  
> RETURN VALUE: 1  
>   
> I am trying to find a way to extract the jobid’s from this output.  
>   
> Thanks in advance.

by DonJ at 2013-02-10 07:38:53

> You’d probably use a regular expression, the -match operator, and the resulting $matches collection. Check out about\_regular\_expressions in the shell’s help.  
>   
> If the string format is pretty consistent, you could also do…  
>   
> `foreach ($job in $jobinfo) { $id = $job.substring(9,13)}`  
>   
> Or something similar. Depends on how consistent the format is.

by OliAdams at 2013-02-12 00:44:11

> Thanks for the fast reply. I didnt realise at first until I saw Don Jones on the book I am reading at the moment your powershell 3 book is fantastic. I have ordered the Toolmaking book aswell.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:58pm UTC](https://forums.powershell.org/t/search-multiline-string-and-edit-it/586/2 "2024-05-16T20:58:27Z")

</div>


