Lets say I have a multiline textbox that I would like to have checked for say, 1-2 digits over a max of 5 lines. I found a regular expression pattern answered on another similar question on here but it was not working for me even after modifying it a number of times.
I’m currently using the following without success.
Dim textCheck As New Regex("(^\d{1,2}$\r?\n?){0,5}", RegexOptions.Multiline)
Could somebody help me out with what I am doing wrong?
Thanks
So you’re wanting to match a list of 1 to 2 digit numbers separated by a newline, up to five? if so, this should work. the last newline is optional and if theres anything else in the string it doesn’t match. (for this, don’t use RegexOptions.Multiline)
I checked this with C#, so I’m not sure if the escape characters are correct. i noticed yours only had 1 slash before the d. in c# you need two, but i removed it from this to make it look like yours.