I found this very handy regular expression on regexlib.com, but i'm at a loss as to how to implement it in my app.
(?:(?:(?<Feet>\d+)[ ]*(?:'|ft)){0,1}[ ]*(?<Inches>\d*(?![/\w])){0,1}(?:[ ,\-]){0,1}(?<Fraction>(?<FracNum>\d*)\/(?<FracDem>\d*)){0,1}(?<Decimal>\.\d*){0,1}(?:\x22| in))|(?:(?<Feet>\d+)[ ]*(?:'|ft)[ ]*){1}
I tested it out using their online testing tool, and it does indeed do everything I need. Pasting it in as a parameter to ColdFusion's REFind() predictably did not work and returned a useless error message.
I'm working in ColdFusion, so I have access to Java classes if needed. Answers in Java or ColdFusion would both be helpful.
A good sample string would be something like: 5' 1/2"
EDIT
I need to make use of the groups in the regex in order to extract the data as opposed to simply using it to validate a string. I guess this means i should using REMatch()? Please excuse my lack of experience with regex!
EDIT 2
It seems that using REFind() with this expression:
(?:(?:(\\d+)[ ]*(?:'|ft)){0,1}[ ]*(\\d*(?![/\\w])){0,1}(?:[ ,\\-]){0,1}((\\d*)\\/(\\d*)){0,1}(\\.\\d*){0,1}(?:\\x22| in))|(?:(\\d+)[ ]*(?:'|ft)[ ]*){1}
is not finding matches for most of the test data i give it, including ones that return matches using the regexlib.com tester: 1ft 2-3/4 in, 2' 3 4/5", 3ft, 4', 5 in, 6", 7.125 in, 3ft 4.5 in