beginners question

Tips on writing regular expressions for searching the post list

Moderators: Quade, dexter

beginners question

Postby evvo » Tue Sep 21, 2004 9:54 am

Hi im a beginner to regular expressions really, just learning the basics, at the moment i require to be able to do some basic validation checking on numbers and hoped for some help here.

for example, our council tax ref numbers are in format of 8 numeric characters and begin with a 3 or a 2, such as 31000044 or 28443562.

my form needs to validate these on this basis so could anyone provide a regex that would do this?

thanks
evvo
n00b
n00b
 
Posts: 1
Joined: Tue Sep 21, 2004 8:29 am

Postby Quade » Tue Sep 21, 2004 11:17 am

Well, this is a "Newsbin Regular Expression" forum. Not a general purpose one.
User avatar
Quade
Eternal n00b
Eternal n00b
 
Posts: 44984
Joined: Sat May 19, 2001 12:41 am
Location: Virginia, US

Registered Newsbin User since: 10/24/97

Postby Smite » Tue Sep 21, 2004 4:21 pm

Code: Select all
^[23]\d{7}$

should work
Please read the FAQ before asking any questions.
If you're new to newsgroups, and the files on them, you can find a very helpful guide here.
User avatar
Smite
Katamari Damacy Addict
 
Posts: 5318
Joined: Sat May 19, 2001 1:54 am
Location: Alberta, Canada

Registered Newsbin User since: 03/27/03


Return to Regular Expressions

Who is online

Users browsing this forum: No registered users and 1 guest