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
Anil_G
(Anil Gorthi)
September 27, 2023, 10:06am
2
@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
Usha_Jyothi
(Usha Jyothi)
September 27, 2023, 10:08am
3
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
Palaniyappan
(Palaniyappan P )
September 27, 2023, 10:13am
5
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
Parvathy
(PS Parvathy)
September 27, 2023, 12:35pm
6
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!!