[TriLUG] OT - Reg Exp question.

James Olin Oden james.oden at gmail.com
Wed Nov 7 14:46:20 EST 2007


On 11/7/07, Scott Lambdin <lopaki at gmail.com> wrote:
> Hi -
>
> Can anyone tell me why /^[0-9][-0-9,]*$/  fails to match a lone 0?  It will
> match a 3 or a 5, but not a zero.  I must have fallen asleep at some point
> in Regular expressions class.
>
It works for me also.  It should match anything starting with a digit
optionally followed by digits, dashes and commas, so the following
should match:

    0
    10
    01-
    0-1
    111,222,555-766

as an example but:

  a0
  01a
  0-a

would not match.

What is the bigger context of your regex (i.e. what code surrounds it)?

Cheers...james
> --Scott
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>



More information about the TriLUG mailing list