I am tying to create a regular expression to validate the following situation. The user will be entering dates in so it could be: YYYY or YYYY,YYYY,YYYY,... If the person is entering multiple dates I want each one to be unique. If anyone can help me out with this I would appreciate it. I have been trying to figure it out but all I can do is get it to match is the simplest one YYYY.
Well, let's assume $x is your simplest one for just matching YYYY. You could easily make it allow more than one separated by commas afterwards. ($x(,)?)+ Then if you want to make sure they're all different.. well, my suggestion would be to split/explode your match at commas and then compare each one to the others, or find a function that'll make an array unique.