Consider M, T, W, TH, F, S, SU - days of the week.
I have a regex that works well, with the exception of one scenario where there is no weekday sequence, i.e. no M , T , W , TH , F , S , SU at the expected location inside the line.
For example, q10MT valid, but q10HT is not valid.
Below is my expression:
string expression = "q(\\d*)(M)?(T(?!H))?(W)?(TH)?(F)?(S(?!U))?(SU)?";
In the case of q10MT , the result of q10MT correct, but in the case of q10HT output of q10 , which is incorrect, my regular expression should not return a value or an empty string if there is no match.
What changes do I need to make to achieve this?
source share