I just realized that it probably needs one more revision to this:

^[0-9\.-][0-9\.]+[0-9]+

The problem with the previous one is that it would allow -. as a
number, which it obviously is not. The new regex requires the last
character to be a number. This should be fine in almost all
situations, so -.9 would pass but -9. would not. Now, technically, -9.
is a number if you are keeping track of margin of error calculations
as it says you know the precision of the number to the single whole
number. Almost no one would ever write it that way except a few
pedantic physicists. And those folks usually don't have error margins
in that realm. But it is technically possible, so there's the caveat.

Judah

On Wed, Apr 20, 2011 at 11:14 AM, Judah McAuley <ju...@wiredotter.com> wrote:
> Yeah, I think that Greg has it right. Didn't notice the bit where it
> can't be a single dash but when I test the regex with a + instead of *
> it does not match single dash.
>
> ^[0-9\.-][0-9\.]+
>
> Judah
>
> On Wed, Apr 20, 2011 at 10:58 AM, Greg Morphis <gmorp...@gmail.com> wrote:
>>
>> That "*" means 0 or more, could you change it to "+" meaning 1 or more?
>> Since there has to be a number?
>> Regex is not my strong suit either
>>
>> On Wed, Apr 20, 2011 at 12:21 PM, G Money <gm0n3...@gmail.com> wrote:
>>>
>>> Rats...it still allows just a single dash "-"
>>>
>>> On Wed, Apr 20, 2011 at 11:57 AM, Judah McAuley <ju...@wiredotter.com>wrote:
>>>
>>>>
>>>> Ok, here's what I've got so far before my meeting:
>>>>
>>>> ^[0-9\.-][0-9\.]*
>>>>
>>>> That says: start with a single character that is numeric, a period or
>>>> a negative, then followed by any number of characters that is numeric
>>>> or a period.
>>>>
>>>> This seems to completely match 0.34, -0.34, -.34, .34 but fail for
>>>> .3-4, Q34 etc.
>>>>
>>>> Judah
>>>>
>>>> On Wed, Apr 20, 2011 at 9:37 AM, G Money <gm0n3...@gmail.com> wrote:
>>>> >
>>>> > On Wed, Apr 20, 2011 at 11:35 AM, Judah McAuley <ju...@wiredotter.com
>>>> >wrote:
>>>> >
>>>> >>
>>>> >> Hmm...would you want to make sure that there is a number between the
>>>> >> dash and period? Would -.34 be valid? I'm trying to work on a regex
>>>> >> (not my strong suit) while I wake up.
>>>> >>
>>>> >
>>>> > No, we wouldn't need a number between them, since "negative thirty four
>>>> > one-hundreths" is a perfectly acceptable number.
>>>> >
>>>> > I appreciate your time Judah.
>>>> >
>>>> >
>>>> >
>>>>
>>>>
>>>
>>>
>>
>> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:336569
Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm

Reply via email to