Help with RegExp to match and capture Foot-Inch.
I'm writing a script to convert any text from foot-inch to just inches. I am pulling my hair out trying to get a RegExp that will match all my corner cases as well as capture the correct info. I need to capture the Feet portion (if present), the inches portion (if present) and the fractional inches portion (if present). Also, these may be preceeded or followed by other text in the same line. I want to use the same RegExp pattern to do the replacement using String.replace().
Are there any RegExp gurus out there that can help? Here are all the cases I need to deal with (spaces are indicated with a "•"):
13'-•2"
13'•-2"
13'•-•2"
13'•2"
13'2"
13'-2"
8'•6•3/4"
8'6•3/4"
8'-•6•3/4"
8'-6•3/4"
8'•-6•3/4"
8'•-•6•3/4"
7'•1/2"
7'1/2"
7'-•1/2"
7'-1/2"
7'•-1/2"
7'•-•1/2"
4'
3/8"
3•3/8"
14"
It would be nice if the group numbers could match across each case (i.e. feet are always group 1), but they don't need to be the same number so long as I can logic out which is which by the number of groups or which groups are undefined.
