Regex to extrac text between (multi-lines)

Hi,

Hope the following helps you.

Regex to extract firstname which is between “Your first name and middle initial”____Last name
Output : Jaul A

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Your first name and middle initial).*?(?=Last name)").Value

Regex to extract text or string between “Last name” _____“your social security number”
Output : Staffer

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Last name).*?(?=Your social security number)").Value

Regex to extract social security number after the text “Your social secuity number”
Output : 153-10-6799

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Your social security number )[-\d]*").Value

Regex to extract text between “If you have a P.O box, see instructions.”_____“Apt. no.”
Output : 167 Cats Black Road

System.Text.RegularExpressions.Regex.Match(yourString,"(?<= If you have a P.O. box, see instructions\.).*?(?=Apt\. no\.)").Value

Regex to extract text after "below (see instructions)
Output : Iphratta PA 57612

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=below \(see instructions\)\.).*").Value

Main.xaml (7.7 KB)

Regards,

1 Like