RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Feet-inch to Decimal
Expression
(?:(?:(?<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}
Description
I needed an expression that would break down a written measurement, like 12' 2-15/16", into groups of feet, inches, fractional inches (num/dem). This is a modified expression based on Trevor Braun's orginal regex. Added the "ft" & "in" suffixes and the fraction's Numerator & Denominator groups.
Matches
1ft 2-3/4 in, 2' 3 4/5", 3ft, 4', 5 in, 6", 7.125 in, 3ft 4.5 in
Non-Matches
1ft 2-3/4in, 4in
Author Rating: The rating for this expression. Normand Frechette
   Displaying page 1 of 1 pages; Items 1 to 1

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials