Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
(?:(?:(?<Feet>\d+)[ ]*\'){0,1}[ ]*(?<WholeInches>\d*(?![/\w])){0,1}(?:[ ,\-]){0,1}(?<Fraction>\d*\/\d*){0,1}(?<Decimal>\.\d*){0,1}\")|(?:(?<Feet>\d+)[ ]*\'[ ]*){1}
|
Description |
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:
|(?<Decimal>\.\d{3}\"*)
to the end of the expression
Hope it helps you.
|
Matches |
1/4" x 2.125" Flat 44W x 20'3.5" | 1/8" x 4" C-1018 flat x 14' 5-1/4"
|
Non-Matches |
44W | 8 @ 21 W.F. beam | 1/4 x 2.125 Flat 44W x 20
|
Author |
Rating:
Not yet rated.
Trevor Braun
|
Displaying page
of
pages;
Items to