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
You can try with Regex Expression?
System.Text.RegularExpressions.Regex.IsMatch(YourString,"\d\/")
Output
Regards
Gokul
2 Likes
If string 1 is found i want to extract nunbers before slash
You can try with Regex after checking the condition
System.Text.RegularExpressions.Regex.Match(YourString,"\d+(?=\/)").Tostring
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
System.Text.RegularExpressions.Regex.Match(YourString,"\d{9}(?=\/)|\d{9}").Tostring
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.