Re: including . in a pattern match



On 1/27/06, Keith Worthington <keithw@xxxxxxxxxxxxxxxxx> wrote:
snip
> I have tried a couple of things but I am struggling with how to optionally
> match the decimal point.
>
> I think what I need is the code equivilant of:
> zero or more numbers followed by
> zero or one decimal point followed by
> one or more numbers followed by
> either ' or "
snip

Take a look at Regexp::Common
(http://search.cpan.org/~abigail/Regexp-Common-2.120/lib/Regexp/Common.pm).
What you want is $RE{num}{real} out of that package. It will match
any real number.
.



Relevant Pages