c# - Regex filter string number and number not working -
i trying extract string in format "[\r\n \"mg480612230220150018\"\r\n]" using regex, trying match number , alphabet min length of 5 character not working, therefore can guarantee extract data (mg480612230220150018)
regex regex = new regex(@"^[0-9a-za-z]{5,}$"); match match = regex.match(availability.id.tostring()); if (match.success) { var myid = match.value; }
this work you:
regex regex = new regex(@"[a-z\d]{5,}", regexoptions.ignorecase);
regex explanantion:
[a-z\d]{5,} options: case insensitive match single character present in list below «[a-z\d]{5,}» between 5 , unlimited times, many times possible, giving needed (greedy) «{5,}» character in range between “a” , “z” (case insensitive) «a-z» “digit” (any decimal number in unicode script) «\d»
Comments
Post a Comment