i need write validation ms enterprise library. validation purpose validate string should have @
keyword @ atleast once , can have thing of 120 length, sure how it.
<validator type="microsoft.practices.enterpriselibrary.validation.validators.containscharactersvalidator, microsoft.practices.enterpriselibrary.validation, version=6.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" characterset="@" containscharacter="any" name="contains characters validator" />
trying doesn't solve purpose.
or regex work..?
instead of using containscharactersvalidator
, can use regexvalidator
suitable regular expression.
if requirements are:
@
anywhere in string, 0 many instances- total string length between 1 , 120 characters
- other allowed characters alphanumeric only
then regex of [@a-za-z0-9]{1,120}
should job you.
Comments
Post a Comment