Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegExp

Status
Not open for further replies.

sergeiY

Programmer
Feb 13, 2003
132
AU
Is it possible to write a regular expression that will validate lenght instead of value ?

I need to check that length of passed in value is greater than zero or its length equal to zero.

I know how to search for a specific value but don't know if I can check for length...

I need it to be a regular expression as I have a validator class that takes rules(regexp) and then I can execute a rule on a specific value.

Any help will be greatly appreciated.

Sergei
 
show us what worked for you then?

One pattern that might work:
Code:
"^.{5}$"
(exactly 5 of any character except newline)

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top