“ACN - Test Number & Test Channel Statements 15.09.23”… I want to get Test Number , Test Channel from this string. Can someone help to do this ?
“ACN - Test Number & Test Channel Statements 15.09.23” Input
Test Number , Test Channel is the output i want
@ajnaraya ,
If the Sentences are similar for all the cases you can make use of below methods
TestNumberOutput = Split(Split(“InputVar”,"ACN-")(1),"&")(0).trim
TestChannelOutput = Split(Split("InputVar","&")(1)," Statements")(0).trim
Regards,
Hi @ajnaraya
You can use the below regular expressions to extract the required output from the Input data.
- Assign -> Input = "ACN - Test Number & Test Channel Statements 15.09.23"
- Assign -> Output = System.Text.RegularExpressions.Regex.Matches(Input.ToString,"((?<=&\s+|\-\s+)[A-Za-z]+\s+[A-Za-z]+)")
Check the below image for better understanding.
Hope it helps!!
TestNumber=System.Text.RegularExpressions.Regex.Matches(str,“(?<=ACN\s.\s)\b\w+\s\w+|\w+\s\b.*(?=\sStatements)”)(0)
TestChannel=System.Text.RegularExpressions.Regex.Matches(str,“(?<=ACN\s.\s)\b\w+\s\w+|\w+\s\b.*(?=\sStatements)”)(1)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.