List Info

Thread: Re: Prices




Re: Prices
country flaguser name
United States
2007-02-27 11:16:05
For my own clarification, you're trying to match a four or
five
character string consisting of one or two numbers followed
by a period
followed by 2 more numbers.  The last two numbers can end in
a 1 or a
2, or begin with a 9.

This pattern should work:
d{1,2}.(?:(?:d[12])|(?:[9]d))

If you need an unspecified number of digits before the
period, you can
change it to :
d+?.(?:(?:d[12])|(?:[9]d))

On Feb 27, 1:23 am, "rosco" <r...teafromtaiwan.com> wrote:
> I'm trying to use regex for a shopping cart.
>
> if ($subtotal =~ /d*d.d[12]/)
>
> works correctly e.g will find 9.81 or 15.52
>
> ...but I also want to find prices in the format xx.9x
>
> I've tried...
>
> if ($subtotal =~ /d*d.[9]d/)
>
> and
>
> if ($subtotal =~ /d*d.[9]d/)
>
> ..but this does not seem to work. What am I doing
wrong?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )