Reqex match next line

I need to match a specific name, but the name has to be under the line “Annoncør”.

“Vores ref. Media
Navn Else Terest test Navn post ( 1263 )
Telefon 12 23 34 45 Adresse testgade 47
Fax 0000 Test
E-post mailtest@mail.com
Materiale
Annoncør Materiale fra Teest
Navn test 123 - 1234567 ( 1c23 ) Kontaktpers. Else Terest”

In this case i need to match “test 123 - 1234567 ( 1c23 )” thanks <3

assign this to string variable to get your result

system.Text.RegularExpressions.Regex.Match(txt, "(?s)Annoncør.*?Navn(.*?) Kontaktpers").Groups(1).Value

As an alternate
grafik

refering to group 1
grafik

(?<=Annoncør)(?:.*\n.*Navn)(.*?)(?=Kontaktpers)

Alternate:
(?<=Annoncør)(?:[\s\S]*?Navn)(.*?)(?=Kontaktpers)

As the dot is not including the line break \n, we added it onto the pattern extraction strategy

Hi @eltmo
You can try this approach as well to get the next line below Annoncør

arrLines= System.Text.RegularExpressions.Regex.Match(strLines,“.*”,RegexOptions.Multiline).Cast(Of Match).Select(Function(e) e.ToString).ToArray()
strLine= (From e in arrLines
Where e.ToString.StartsWith(“Annoncør”)
Select Array.IndexOf(arrLines,e)+1).ToArray(0)

where strLines is a variable what has the input string value.

Thanks & Regards,
Nived N