Regex to get a substring from string

String : Person Details for Peter Parker [987654321]
Substring : Peter Parker

Can anyone please help with the regex expression to get above substring from the string??

Note: The substring is variable and the number also… The only constant is ‘Person Details for’


(?<=Person Details for\s).*?(?=\s\[\d+\])


Person Details for (.?)\s[\d+]

Hope it helps!!

Hi @Tanmay_V_Chetule

Try this

(?<=Person Details for ).*(?= \[\d+])

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