Find the second word of second line by regex

I have a text file that tries to find second words in the second line using the Regex code, I used “(?<=Firstname\sLastname\r?\n).+” but it didn’t help. I want to find a simple method by regex to find second words in the second line
I have tried: “(?<=Firstname\sLastname\r?\n).+”

input text:
Firstname Lastname
Test Testperson

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=^.*\n\s*\S+\s+)\S+").Value

Regards,

1 Like

It works perfectly thanks

1 Like

Hi @araz_davlund1

How about this expression

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=\n)\S+\s(\S+)").Groups(1)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.