Need to retrieve dimensions from the text where they can be specified in a couple of ways:
- "... 10.5 inches x 5 feet x 2 inches ..."
- "... 10 inches x 5 inches ..."
- "... 10 inches x 5 inches ..."
- "... 10 x 5 inches ..."
There can be two or three dimensions and each might have its own measurement type or not have it.
I am struggling to add the list of optional dimension types and make the search of the third vale optional in the regex:
dimensions = re.findall(r'(\d+\.?\d*)\s*inches?feet?\s*x\s*(\d+\.?\d*)\s*inches?feet?\s*x?\s*(\d+\.?\d*)?\s*inches?feet?',string)