Regular Expressions 101

Community Patterns

Feet and inches and with fraction

0

Regular Expression
ECMAScript (JavaScript)

/
^(\+ *|- *)?((?!0+)\d*?|(?!0{2,})\d*?\.(?!0+)\d*?)('|")$|^(\+ *|- *)? *(?!0+)\d+?' *-? *(\d+?|\d*?\.\d*?)"$|^((\+ *|- *)?((?!0+)|0 )\d*? *(?!0+)\d+?\/(?!0+)\d+?('|"))$
/
mg

Description

Matches feet and inch numbers with and without fractions but using the american traditional feet symbol ' (single quote) and inch symbol " (double quote). Number must be on a single line by itself. Multi-line is on for testing only and should be turned off. Proceeding and following spaces are not allowed (trim first).

Submitted by Jeff Stuyvesant - 7 years ago