I'm trying to parse length quantities that use Imperial shorthand notation ('
for feet, "
for inches), and I'm in a bit of a quandary. Using this regular expression:
/\d+(\.\d+)?(?:[ -]\d+\/\d+)?(?:\')/g
I can match the following strings (each passed separately within a larger string):
5'6"
(matches5'
)6'
3 1/2'
12.5'
However, I've run across strings where ''
is used in place of "
. I tried adding [^\']
at the end, but that would match 5'6
in the first example, and if I put [^\'\d]
, it wouldn't match the first example at all. Any help?