Can someone help me or give an idea for a regex that would work to this 2 different conditions.
A single lined regex that would get both output . Thanks for any help.
#First Condition - Data1
If joint return, spouse’s first name and middle initial
Last name
BOYER
Last name
output : BOYER
#Second Condition - Data2
Your first name and middle initial Paul A Last name Staffer Your social security number 184-80-8799
If joint return, spouse’s first name and middle initial Judith B Last name Staffer Spouse’s social security number 185-80-9544
Output : Staffer
Current regex : System.Text.RegularExpressions.Regex.Match(data,"(?<=Last name).*?(?=Your social security number)").Value
but when I tried
System.Text.RegularExpressions.Regex.Match(data,“(?<=Last name\n)[\w\W]*(?=\nLast name)|(?<=Last name )[\w\W]+(?= Your social security number)”).Value
System.Text.RegularExpressions.Regex.Match(data,“(?<=Last name\n)[^Last name]\w*(?=\nLast name)|(?<=Last name )[\w\W]+(?= Your social security number)”).Value
it works on regex101 but it does not work on uipath