Try this: /(^\w{13}$)|(^\w{17}$)/
x = "1234567890" # 10 chars -- should be false
x = "1234567890123" # 13 chars -- should be true
x = "12345678901234" # 14 chars -- should be false
x = "12345678901234567" # 17 chars -- should be true
(Using Ruby)
puts x.match(/(^\w{13}$)|(^\w{17}$)/)
-John
On Aug 25, 2009, at 11:02 AM, bruce sisk wrote:
I am new to regular expressions.
I need to limit a field to either 13 characters...or 17 characters...
This is what I came up with:
\b[A-Za-z0-9]{13}\b|\b[A-Za-z0-9]{17}\b
This doesn't seem to work...individually they do...but when joined
with the OR it always fails.
Any help from those who have experience would be appreciated.
How does this belong on the ARSList you ask??? I am working with
Kinetic Request and can use Regular Expressions to validate a field
before it is submitted to Remedy.
I need to throw the error before submitting the request.
Bruce Sisk
BFS Enterprises
________________________________________
PeoplePC Online
A better way to Internet
http://www.peoplepc.com
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor:rmisoluti...@verizon.net ARSlist: "Where the Answers
Are"
--
John David Sundberg
235 East 6th Street, Suite 400B
St. Paul, MN 55101
(651) 556-0930-work
(651) 247-6766-cell
(651) 695-8577-fax
john.sundb...@kineticdata.com
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor:rmisoluti...@verizon.net ARSlist: "Where the Answers Are"