Hi, I'm not sure that this is the right forum for this, but I've been having
a very tough time completing this expression, and I was hoping someone might
have some suggestions for me.
I am trying to read measurements out of a text description, and I have a
working expression, but it captures a pile of empty matches. I obviously am
not interested in them, but I screw up my functionality when I try to get
rid of them.
My expression is:
(?:(?:(?<Feet>[0-9]*)\'){0,1}(?:(? :(?<WholeInches >[0-9]*(?![/\w])){0,1}(?:[
,\-]){0,1}(?<Fracti on>[0-9]*\/[0-9]*){0,1}(?<Decim al>\d*\.\d*){0, 1}\")){0,1})
Some test strings are:
1/4" x 2" Flat 44W x 20'
1 1/4" x 2" Flat 44W x 20'
1/4" x 2.5" Flat 44W x 20'
1/4" x 2" Flat 44W x 20' 3"
1/4" x 2" Flat 44W x 20' 3.5"
1/4" x 2" Flat 44W x 20' 1/2"
1/8" x 4" C-1018 flat x 14' 5-1/4"
I really could use some help on this. I've been working on this on and off
for several months now, and just can't seem to get it right.
a very tough time completing this expression, and I was hoping someone might
have some suggestions for me.
I am trying to read measurements out of a text description, and I have a
working expression, but it captures a pile of empty matches. I obviously am
not interested in them, but I screw up my functionality when I try to get
rid of them.
My expression is:
(?:(?:(?<Feet>[0-9]*)\'){0,1}(?:(? :(?<WholeInches >[0-9]*(?![/\w])){0,1}(?:[
,\-]){0,1}(?<Fracti on>[0-9]*\/[0-9]*){0,1}(?<Decim al>\d*\.\d*){0, 1}\")){0,1})
Some test strings are:
1/4" x 2" Flat 44W x 20'
1 1/4" x 2" Flat 44W x 20'
1/4" x 2.5" Flat 44W x 20'
1/4" x 2" Flat 44W x 20' 3"
1/4" x 2" Flat 44W x 20' 3.5"
1/4" x 2" Flat 44W x 20' 1/2"
1/8" x 4" C-1018 flat x 14' 5-1/4"
I really could use some help on this. I've been working on this on and off
for several months now, and just can't seem to get it right.
Comment