RegExpValidationRule

Kind of class: public class
Package:
Inherits from:
Implements:
Known subclasses:
Classpath: org.asaplibrary.util.validation.rules.RegExpValidationRule
File last modified: Friday, 13 May 2011, 22:20:36
IValidationRule implementation that checks whether or not a string matches a regular expression. Use this with the Validator class and IValidatable implementations that return a String.
Example
  • mValidator = new Validator();
    mValidator.addValidationRule(new RegExpValidationRule(tName, ".+"));
    
    Be aware that if backslashes are used ("\"), they have to be put in double. P.e.the regexp for email validation becomes: "(\\w|[_.\\-])+@((\\w|-)+\\.)+\\w{2,4}+".

Summary

Constructor
Instance methods
Instance methods inherited from ValidationRuleBase

Constructor

RegExpValidationRule

function RegExpValidationRule(inTarget:IValidatable, inExpression:RegExp = null, inValidIfMatch:Boolean = true) : void

Constructor

Parameters
inTarget :IValidatable object
inExpression :regular expression to validate with.
inValidIfMatch:if true, value of IValidatable is considered valid if it matches the regular expression; otherwise it is considered invalid

Instance methods

isValid

function isValid() : Boolean
Returns
  • true if value of IValidatable is considered valid