I have requirement to validate a range. The input is in the following format:
string example1 = "anydate between 20100101 ~~ 20100101";
string example2 = "anydate between 20100101 and 20100101";
string example3 = "docid between 1 ~~ 2";
I'm using the following regex:
\b(\w)*(?<operator>Between|contains)\b(?<prefix>.*).*?(?<OP>~~|and)[ ]?\b(?.*)\b
When user inputs "anydate between 20100101 ~~ 20100101 and test1"
it is failing and it captures till test1
.
How to make my regex less greedy and only caputure till 20100101
?