Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compiler Tools JavaCC > Regular express...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 459 of 549
Post > Topic >>

Regular expressions with numbers

by Raul Brito <raul.brito@[EMAIL PROTECTED] > May 3, 2007 at 12:53 AM

Hello all,

I'm starting with Javacc and it isn't getting easy... there seems to
lack some do***entation on regular expressions.

My goal is to create a regular expression that matches an unpadded
number with 3 digits maximum. For example,  298 or 12 or 1 would all
match this regular expression.
I've been using every variation I can imagine, and it simply doesn't
seem to work.

For example, shouldn't something like this work?

(["1"-"9"]["0"-"9"]["0"-"9"]|["1"-"9"]["0"-"9"]|["1"-"9"])

It works for an unpadded number with 2 digits, that is (["1"-"9"]
["0"-"9"]|["1"-"9"]) , but with 3 or digits it always fails.

So, if any of you knows the secret formula for this, please let me
know!

Thanks for your help.
Raul
 




 5 Posts in Topic:
Regular expressions with numbers
Raul Brito <raul.brit  2007-05-03 00:53:12 
Re: Regular expressions with numbers
AC <user@[EMAIL PROTEC  2007-05-05 03:22:17 
Re: Regular expressions with numbers
Raul Brito <raul.brit  2007-05-06 05:58:41 
Resolving ambiguous tokens (was Re: Regular expressions with num
AC <user@[EMAIL PROTEC  2007-05-06 20:28:20 
Re: Resolving ambiguous tokens (was Re: Regular expressions with
Raul Brito <raul.brit  2007-05-10 03:10:15 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:00:08 CDT 2008.