Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Validation-regex
System
I'm trying to limit the number of characters in a textarea element in a DCT to 100. I'm using the validation-regex documention provided by IWOV's Article # 1910 with no success. Regex is validating the the textarea element as an error when text under 100 is provided. No validation error occurs when no text is entered. Below is the DCT I'm using. For testing purposes I have changed the text limit to 3 instead of 100.
Find more posts tagged with
Comments
pandit
from what i saw , the regex in that article tells you how to exceed a limit, not how to contain it .
try something like /[a-zA-z0-9_?]{0,100}/
This should match the characters in [.....] within that limit..
Migrateduser
thanks for the note....I realize this after and tried using the following ^/.{0,3}/$...
This is suppose to allow any character from 0 to 3 in length to be entered into the element. When the character exceeds 3 then an error is raised. This seems to do the same as what you have suggested.
This is not working either.
Any ideas..?
Thanks
pandit
you are using ^/.{0,3}/$
this means that it will search for a string starting with a "/" and ending with a "/"..if thats what you want, then try replacing the "." with "[a-zA-Z0-9_]" or "[\w]"This will match all the characters within the [....].
but i feel removing the ^ and the $ should do it..
pandit
try this in your code:
validation-regex="^.{0,100}$"
OR
validation-regex="^.\{0,100\}$"
should work
Migrateduser
We are in business...thanks for the help.
aces
I am trying to validate a field that has a maxlength of 2 and it is a number. I tried this:
<text size="2" required="f" maxlength="2" validation-regex="^[0-9]"/>
but when I type in 2a, there's no validation on the text (a). I was able to save the file. Any suggestions?
Migrateduser
The regex you wrote only assures that the first character is a number. Try this:
validation-regex="^\d\d$"
or
validation-regex="^[0-9][0-9]$"
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
Adam Stoller
Actually - If you want to accept both 1 and 2 digit numbers - then I think it needs to look like:
validation-regex="^([0-9]|[0-9][0-9])$"
--fish
(Interwoven Senior Technical Consultant)
A6.dcpackage
mogoo
fish, I'm shocked! You're usually really good about getting these things down to the smallest possible chunk. Couldn't you just say this...
validation-regex="^(\d{1,2})$"
-maureen
Migrateduser
Oh Maureen, I am sure that fish was just distracted by the pure joy he got correcting my wrong answer.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
Adam Stoller
I thought about that - but didn't have the time / energy to test out to verify that systax worked as desired/expected - so I went for the long-hand approach.
--fish
(Interwoven Senior Technical Consultant)