Need help on regex from a image extracted text

Hi I need to extract Toddy Venkatesh and Surya Prakash from below string pls help

Batch Status Pendintverlfication ID MITS. 15May23.901 Create Date V15/233.13 PM

Created By Surya Prakash Update Data 5/15/23 313 PM updatatilly
Xxxhshsjsjjsjsjsjshhs
Ahshjdhdjdhdjdjdj
Shehhdhdjdjdjdjjdjd
Shhshdhdjdjdjiwjejdbdnnd
Shjsjejdjdn
11343873
Ahsjjdkrkdkdkkrkfktktktkktktktktktktktjtjtj
[APPROVED By Toddy Venkatesh at 3:18 pm, May 16, 2023

1 Like

@Sudheer_Kumar1

Please try this

(?<=Created By).*(?=Update)

Usage: System.Text.RegularExpressions.Regex.Match(str,"(?<=Created By).*(?=Update)").Value

(?<=APPROVED By).*(?=at)

Usage: System.Text.RegularExpressions.Regex.Match(str,"(?<=APPROVED By).*(?=at)").Value

cheers

image

put these patterns in
system.text.regularexpressions.regex.match(string variable,“regex pattern”).value.trim

(?<=By).*(?=at)

(?<=By).*(?=Update)

to get Surya Prakesh
System.Text.RegularExpressions.Regex.Matches(str,“/(?<=Created By\s).(?=Update)|(?<=APPROVED By\s).(?=at)/gm”)(0).value

to get Toddy Venkatesh
System.Text.RegularExpressions.Regex.Matches(str,“/(?<=Created By\s).(?=Update)|(?<=APPROVED By\s).(?=at)/gm”)(1).value

Hi

You can try with single expression and get the matches

out_matches = System.Text.RegularExpressions.Regex.Matches(in_string.ToString, “(?<=By\s)([A-Z][a-z]+ [A-Z][a-z]+)”)

Explanation

Hope this clarifies

Cheers @Sudheer_Kumar1

Hi @Sudheer_Kumar1

strinput="Created By Surya Prakash Update Data 5/15/23 313 PM updatatilly
          Xxxhshsjsjjsjsjsjshhs
          Ahshjdhdjdhdjdjdj
          Shehhdhdjdjdjdjjdjd
          Shhshdhdjdjdjiwjejdbdnnd
          Shjsjejdjdn
          11343873
          Ahsjjdkrkdkdkkrkfktktktkktktktktktktktjtjtj
          [APPROVED By Toddy Venkatesh at 3:18 pm, May 16, 2023"

output= System.Text.RegularExpressions.Regex.Match(strinput,"(?<=By\s)[A-Za-z]+\s*[A-Za-z]+").Value

Hope it helps!!