How can we check if string contains combination of numbers and forward slash

For example sometimes we get strings like
string1=568974231/A23579
string2=321546987
String3=o/p
How can we check if strings contains combination of numbers and forward slash like string1
Can anyone please help

HI @vnsatyasunil

You can try with Regex Expression?

System.Text.RegularExpressions.Regex.IsMatch(YourString,"\d\/")

image

Output

image

Regards
Gokul

2 Likes

If string 1 is found i want to extract nunbers before slash

HI @vnsatyasunil

You can try with Regex after checking the condition

System.Text.RegularExpressions.Regex.Match(YourString,"\d+(?=\/)").Tostring

image

Regards
Gokul

Not getting output
Sometimes string may be 123456789 or 523146987/A23584.in both the cases we need to extract first 9 digits before slash

HI @vnsatyasunil

System.Text.RegularExpressions.Regex.Match(YourString,"\d{9}(?=\/)|\d{9}").Tostring

image

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