snip > > The only challenge is that the $p_number pattern seems to match all of > the following. 10 1/2 10-1/2 10--1/2 > > I started out with (\s+|-?) as my delimiter pattern and then when that > didn't work I changed it to (\s+|-{1,1}). It still matches the case > with two hyphens. Can you tell me why? > > my $p_fraction = qr{ # match a fractional number > ($RE{num}{int}) # integer pattern > (/) # fraction delimiter > ($RE{num}{int}) # integer pattern > }x; > > my $p_number = qr{ # match a number > ( > ($RE{num}{real}) # real pattern > | > ($RE{num}{real}) # real pattern > (\s+|-{1,1}) # mixed number delimiter > ($p_fraction) # fraction pattern > | > ($p_fraction) # fraction pattern > ) > }x;
Well, the answer was right in fromt of me. The delimiter pattern is mattching the first hyphen and the integer pattern is matching the second hyphen as a negative sign. Arrrgh! The Regex::Dommon::Number documentation doesn't indicate a way to match only numbers without a sign. I am thinking I will just lose the - as part of the delimiter and let the integer pattern take care of it. A bit messy but it will work. If anyone can think of a better idea I would appreciate your time in sharing it. Kind Regards, Keith -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>