I'm using a Java program and I'm trying to create a regular expression that will match anything that has two dimensions and will not match anything that goes over that.
I'm also trying to indicate two capture groups so that I can capture each dimension value separately. The dimensions have to be entered in the following format Some number x Other number (separated by the x)
Here are some examples to better explain what I'm trying to do:
S (26 in x 30 in): This should match and capture 26 and 30.20 x 40: This should match and capture 20 and 40.Standard Size (10 x 40): This should match and capture 10 and 40.20 x 40 x 80: This should not match at all.M (26 in x 30 in x 50 in): This should not match at all.
I have tried this regex but its still considering 3 dimensions as valid:
([\d.,]+).*?[xX] ?([\d,.]+).*