- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Pattern Title
(?:(?:(?<Feet>\d+)[ ]*\'){0,1}[ ]*(?<WholeInches>\d*(?![/\w])){0,1}(?:[ ,\-]){0,1}(?<Fraction>\d*\/\d*){0,1}(?<Decimal>\.\d*){0,1}\")|(?:(?<Feet>\d+)[ ]*\'[ ]*){1}
I needed an expression to extract measurements from text to extract steel sizes from product descriptions, and I came up with this. It will only match on measurements that have complete dimensions (i.e. measurements with foot and inch marks in the positions you'd expect them). My personal experience required that I also be a little lax and allow measurements such as: .125 (for wall thicknesses and sheet metal thicknesses) with no inch marks. You can accomplish this by including: |(?&lt;Decimal&gt;\.\d{3}\&quot;*) to the end of the expression Hope it helps you.
1/4" x 2.125" Flat 44W x 20'3.5" | 1/8" x 4" C-1018 flat x 14' 5-1/4"
44W | 8 @ 21 W.F. beam | 1/4 x 2.125 Flat 44W x 20
Author Rating: Not yet rated. Trevor Braun
   Displaying page 1 of 1 pages; Items 1 to 1

Copyright © 2001-2018, | ASP.NET Tutorials