I'm trying to verify that a user inputs coordinates in the format: x,y so I'm using regular expressions. x and y can be between 1 and 15, so I used
[1-15]\\d{1,2},[1-15]\\d{1,2}
but that didn't work because 15
isn't a digit obviously. I changed it to
\\d{1,2},\\d{1,2}
so at least I can confirm that its two one or two digit numbers, but it could be up to 99
on either side; not good. I've tried a few other ways like
\\d{1}|[1]\\d[0-5]\\d...
but nothing works and honestly I've been looking at all this so long it doesn't make sense anymore.
More importantly, is it even good practice to use java's regular expression feature? I could think of other ways to do this, but this is just for a personal project I'm working on and trying out different approaches to things I usually do messily.