Search from text in string and write index

Hi, I have a bit of an issue with a script. Basically I have a text of variable length inside a variable, I have to extract some specific parts when a specific string is present.

Here is an example of my text

çCodeç:13 çLabelç:çFirst one Passç çJustifiedç:false çCodeç:2 çLabelç:çSecond oneç çJustifiedç:false

You see the ‘ç’ charachter because my original text had a bunch of ‘"’ that was causing problems.

What I need to get in this case is “First one” and “Second one” to display on screen

Here is my trials so far

$Path = "C:\SupVNC\Details.txt"
$result2 = Get-Content -Path $Path
$profiliedit = $result2 -replace '"', 'ç'

$pattern3 = "Labelç:ç(.*?)ç"
$etichetta1 = [regex]::Match($profiliedit,$pattern3).Groups[1].Value 

Doing this returns only “First one” tho. Another route I was thinking was looking for the “Labelç:ç” string and select the position of the first character using IndexOf

$index = $profiliedit.IndexOf("Labelç:ç")

This still only returns the first occurrence, any ideas?
I don’t knwo the number of occurencies in my text, it varies from 1 to 4.

Thanks in advance

You came SO close!

You want to use “Matches”, not “Match” to find multiple matches.

$s = "çCodeç:13 çLabelç:çFirst one Passç çJustifiedç:false çCodeç:2 çLabelç:çSecond oneç çJustifiedç:false"
$p = "Labelç:ç(.\*?)ç"
$e = [regex]::Matches($s,$p)

Thank you so much, it worked like a charm

If you’re processing a large number of strings and the pattern never changes, this might be more efficient:

$s = "çCodeç:13 çLabelç:çFirst one Passç çJustifiedç:false çCodeç:2 çLabelç:çSecond oneç çJustifiedç:false"
$p = [regex]"Labelç:ç(.\*?)ç"
$e = $p::Matches($s,$p)