anyone good with custom validators?

G

Guest

Hi I need a custom validator formula for the following

3 letters, a hyphen,3 letters, a hyphen, 4 letters, a hyphen, 5 numbers, a
hyphen,
4 numbers.
so it would validate something like
ABC-DCD-HGDA-12345-4321

I want letters caps.
thanks.
 
G

Guest

Hi thanks for the response. I came up with this by doing a search on the
internet, seems to be working, not
sure if I need the ^ character in the beginning though and not sure what the
\ does.
^[A-Z]{3}-[A-Z]{3}-[A-Z]{4}-[0-9]{5}-[0-9]{4}

Karl Seguin said:
use a RegularExpressionValidator with the following expression:

[A-Z]{3}\-[A-Z]{3}\-[A-Z]{4}\-\d{5}\-\d{4}

It could be made more compact...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
K

Karl Seguin

^ means from the beginning
$ means to the end

I _think_ RegularExpressionValidator applies those by default, but it's just
lazy of me to leave them out. - can be a special character so I thought it
should be escaped, you might not HAVE to though. \d is the same as [0-9]

either one should work :)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
Paul said:
Hi thanks for the response. I came up with this by doing a search on the
internet, seems to be working, not
sure if I need the ^ character in the beginning though and not sure what
the
\ does.
^[A-Z]{3}-[A-Z]{3}-[A-Z]{4}-[0-9]{5}-[0-9]{4}

Karl Seguin said:
use a RegularExpressionValidator with the following expression:

[A-Z]{3}\-[A-Z]{3}\-[A-Z]{4}\-\d{5}\-\d{4}

It could be made more compact...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
Paul said:
Hi I need a custom validator formula for the following

3 letters, a hyphen,3 letters, a hyphen, 4 letters, a hyphen, 5
numbers, a
hyphen,
4 numbers.
so it would validate something like
ABC-DCD-HGDA-12345-4321

I want letters caps.
thanks.
 
G

Guest

ok,Thanks for the additional information.


Karl Seguin said:
^ means from the beginning
$ means to the end

I _think_ RegularExpressionValidator applies those by default, but it's just
lazy of me to leave them out. - can be a special character so I thought it
should be escaped, you might not HAVE to though. \d is the same as [0-9]

either one should work :)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
Paul said:
Hi thanks for the response. I came up with this by doing a search on the
internet, seems to be working, not
sure if I need the ^ character in the beginning though and not sure what
the
\ does.
^[A-Z]{3}-[A-Z]{3}-[A-Z]{4}-[0-9]{5}-[0-9]{4}

Karl Seguin said:
use a RegularExpressionValidator with the following expression:

[A-Z]{3}\-[A-Z]{3}\-[A-Z]{4}\-\d{5}\-\d{4}

It could be made more compact...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
Hi I need a custom validator formula for the following

3 letters, a hyphen,3 letters, a hyphen, 4 letters, a hyphen, 5
numbers, a
hyphen,
4 numbers.
so it would validate something like
ABC-DCD-HGDA-12345-4321

I want letters caps.
thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top