[TriLUG] OT - Reg Exp question.

Andrew Perrin clists at perrin.socsci.unc.edu
Wed Nov 7 14:34:35 EST 2007


Works for me:


aperrin at che:~$ perl -de1

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1):   1
   DB<1> print 'good morning' if 0 =~ /^[0-9][-0-9,]*$/;
good morning
   DB<2>


----------------------------------------------------------------------
Andrew J Perrin - andrew_perrin (at) unc.edu - http://perrin.socsci.unc.edu
Associate Professor of Sociology; Book Review Editor, _Social Forces_
University of North Carolina - CB#3210, Chapel Hill, NC 27599-3210 USA



On Wed, 7 Nov 2007, Scott Lambdin 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.
>
> --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