Get substring using Regex

I just need the string after ‘ROLL:’ using regex expression.
Thanks in Advance.

Input String Examples -
ROLL: Robot, Master (R.M.)
ROLL: Siddy, Duck (S.D.)

Output:
Robot, Master (R.M.)
Siddy, Duck (S.D.)

Hi @Tanmay_V_Chetule

(?<=ROLL:\s).*

Hope it helps!!

1 Like

Hi @Tanmay_V_Chetule

Input="ROLL: Robot, Master (R.M.)"
Output= System.Text.RegularExpressions.Regex.Match(Input,"(?<=ROLL\:\s).+").Value
Input="ROLL: Siddy, Duck (S.D.)"
Output= System.Text.RegularExpressions.Regex.Match(Input,"(?<=ROLL\:\s).+").Value

Hope it helps!!

1 Like

Hi @Tanmay_V_Chetule

Please find the below regex expression

Assign
OutputVariable = System.Text.RegularExpreesions.Regex.Match(InputVariable,"(?<=\w+\:\s+)(.*)").Value

image

Regards

@Tanmay_V_Chetule
image
u can try the below regex:
OutputVariable = System.Text.RegularExpreesions.Regex.Match(InputVariable,“(?<=ROLL:\s)[A-Za-z, (.)]+”).Value

@Tanmay_V_Chetule

System.Text.RegularExpressions.Regex.Replace(str_variable,“ROLL:”,“”).Trim

Cheers!!

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