Hello,
I am new to Regex.
I need a regex to get the below value.
5/5 … : I need first digit, Var1 = 5
10/10 … : I need first digit, Var1 = 10
23/23 … : I need first digit, Var1 = 23
Thanks
Hello,
I am new to Regex.
I need a regex to get the below value.
5/5 … : I need first digit, Var1 = 5
10/10 … : I need first digit, Var1 = 10
23/23 … : I need first digit, Var1 = 23
Thanks
How about this expression?
System.Text.RegularExpression.Regex.Match(InputStr,"^\d+").Tostring
Regards
Gokul
find an anchored regex pattern, defensive to some variations
\d+(?=.*?\/)
Thanks a lot for this
Apologies I just got the update and now my input string values are like this:
Record: 5 /5 … : I need first digit, Var1 = 5
Record: 10 /10 … : I need first digit, Var1 = 10
Record: 23 /23 … : I need first digit, Var1 = 23
Using ur regex getting below output
Record: 5
Record: 10
@Gagan_Chaudhari
try this
Record:\s\d+(?=.*?/)
How about this expression?
System.Text.RegularExpression.Regex.Match(InputStr,"(?<=Record:\s)\d+").Tostring
Regards
Gokul
Try with is expression
RegularExpressions is missing
System.Text.RegularExpressions.Regex.Match(InputStr,"(?<=Record:\s)\d+").Tostring
Regards
Gokul
a tolerate one
Record.*?(\d+)(?=.*?\/)
for further cleansing the number we can get from group 1
@Gagan_Chaudhari Try to import name spaces from imports panel
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.