For eg,I am having string like
TEST-OK_543210123-om sri-876543 student details to change class
from above line I need to extract 543210123
some times it can be 8 digits & sometimes it can be 9 digits. Need to extract that part of 8 or 9 digits.
Please help anyone?
use below expression
system.text.RegularExpressions.Regex.Match(strinput,"\d{8,9}").Value
here string input is your string data
Regards
1 Like
rlgandu
(Rajyalakshmi Gandu)
May 22, 2023, 11:14am
4
System.Text.RegularExpressions.Regex.Match(VarName,“\d{8,}”).Value
After Comma use range what you Want.
I hope this will help you
Yoichi
(Yoichi)
May 22, 2023, 11:48am
9
Hi,
FYI, another approach:
If you want to prevent to match 10 or more digits, the following might be better.
System.Text.RegularExpressions.Regex.Match(yourString,"(?<=^|\D)\d{8,9}(?=\D|$)").Value
Regards,
1 Like
system
(system)
Closed
May 25, 2023, 3:30pm
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.