Match range without duplicating
Match range without duplicating I need to match 1/1 all the way through 4/48. 1/1,1/2,1/3 all the way through 1/48,2/1 through 2/48 ....3/1 through 3/48 and 4/1 through 4/48.... but having a hard time with the regex as it must not contain a comma at the end and not duplicate any thing that was already input. ^([1-4]/([1-9]|[1-4][0-8]|[1-3][0-9]))[?,]+$ Regular expressions may not be the right tool for this. Have you considered parsing the string yourself instead? – Paul Benn Sep 18 '18 at 14:09 While I have not downvoted, as I read thru the comment thread below, I'll say this is not a well thought out question. For all the exceptions you have listed, you should compose a question that has an easy to use test suite of data that covers all of the cases you need to cover. Note that this doesn't mean we need to see all your data, but just enough of each unique type to compose a solution that will work for a small data set or your complete data set. – shellter S