I need a regular expression that matches a combination of a number (greater than 5, but less than 500) and the text string that comes after the number.
For example, the following matches will return true: 6 elements or 450 elements or 300 elements in red (there may be other characters after the word "elements")
While the following lines will return false: 4 elements or 501 elements or 40 red elements
I tried the following regular expression, but it does not work:
string s = "Stock: 45 Items";
Regex reg = new Regex("5|[1-4][0-9][0-9].Items");
MessageBox.Show(reg.IsMatch(s).ToString());
Thank you for your help.
source
share