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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -