How to get required particular strings from regex

Hi Community,

I have to get required string from below three variables with using regex (Need each variable for output)

Input:

Variable1: Offloading Esy OCC
Variable2: onloading Esy OCC
Variable3: M1tOC1 Onloading Testing CR Automation

Output:
Variable1 output: Offloading
Variable2 output: onloading
Variable3 output: M1tOC1

Thanks
Shaik

Hi @shaik.muktharvalli1

Try this

image

inputText.Split(" ")(0)

Regards,

@shaik.muktharvalli1

Using Regex try below

System.Text.RegularExpressions.Regex.Match(inputText,"\w+(?=\s+)").Value

Regards,

2 Likes

Hie @shaik.muktharvalli1 here your regex pattern
image

System.Text.RegularExpressions.Regex.Match( “offloading Esy OCC”,“[1]+”).Value

System.Text.RegularExpressions.Regex.Match( “onloading Esy OCC”,“[2]+”).Value

System.Text.RegularExpressions.Regex.Match(“M1tOC1 Onloading Testing CR Automation”,“^\w+”).Value
output

cheers Happy Automation


  1. a-zA-Z ↩︎

  2. a-zA-Z ↩︎

1 Like

Thank you @lrtetala , @singh_sumit it’s working fine :slightly_smiling_face:

Thnaks
Shaik

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