blob: c0dbaef097543902569044d6e1bc165fc1ea004d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- saved from url=(0014)about:internet --><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" href="../../style.css" type="text/css" media="screen"><link rel="stylesheet" href="../../print.css" type="text/css" media="print"><link rel="stylesheet" href="../../override.css" type="text/css"><meta name="keywords" content="RegExpValidator,mx.validators.RegExpValidator,AMERICAN_EXPRESS,ANY,CANADA_ONLY,DECIMAL_DIGITS,DINERS_CLUB,DISCOVER,INT,LEFT,MASTER_CARD,REAL,RIGHT,ROMAN_LETTERS,US_ONLY,US_OR_CANADA,VISA,actualListeners,actualTrigger,alignSymbol,allowNegative,allowNegative,allowedFormatChars,allowedFormatChars,allowedFormatChars,allowedFormatChars,allowedFormatChars,cardNumberListener,cardNumberProperty,cardNumberSource,cardTypeListener,cardTypeProperty,cardTypeSource,currencySymbol,currencySymbolError,dayListener,dayProperty,daySource,decimalPointCountError,decimalPointCountError,decimalSeparator,decimalSeparator,domain,domain,enabled,enabled,errorCode,errorMessage,errorString,exceedsMaxError,exceedsMaxError,expression,flags,formatError,includeFormatInError,inputFormat,integerError,invalidCharError,invalidCharError,invalidCharError,invalidCharError,invalidCharError,invalidCharError,invalidCharError,invalidCharError,invalidDomainError,invalidDomainError,invalidFormatCharsError,invalidFormatCharsError,invalidIPDomainError,invalidNumberError,invalidPeriodsInDomainError,isError,listener,lowerThanMinError,lowerThanMinError,matchedIndex,matchedString,matchedSubstrings,maxLength,maxValue,maxValue,minDigits,minLength,minValue,minValue,missingAtSignError,missingPeriodInDomainError,missingUsernameError,monthListener,monthProperty,monthSource,negativeError,negativeError,noExpressionError,noMatchError,noNumError,noTypeError,precision,precision,precisionError,precisionError,property,required,requiredFieldError,resourceManager,separationError,separationError,source,subField,subFields,thousandsSeparator,thousandsSeparator,tooLongError,tooManyAtSignsError,tooShortError,trigger,triggerEvent,validateAsString,validationSubField,wrongCAFormatError,wrongDayError,wrongFormatError,wrongLengthError,wrongLengthError,wrongLengthError,wrongLengthError,wrongMonthError,wrongTypeError,wrongUSFormatError,wrongYearError,yearListener,yearProperty,yearSource,zeroStartError,addListenerHandler,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,getValueFromSource,handleResults,initialized,isRealValue,removeListenerHandler,resourcesChanged,validate,validate,validateAll,validateCreditCard,validateCurrency,validateDate,validateEmail,validateNumber,validatePhoneNumber,validateSocialSecurity,validateString,validateZipCode,validationResultHandler"><title>mx.validators.RegExpValidator</title><script src="../../AC_OETags.js" type="text/javascript"></script></head><body><script language="javascript" type="text/javascript" src="../../asdoc.js"></script><script language="javascript" type="text/javascript" src="../../help.js"></script><script language="javascript" type="text/javascript" src="../../cookies.js"></script><script language="javascript" type="text/javascript"><!--
asdocTitle = 'RegExpValidator - ApacheFlex API Reference';
var baseRef = '../../';
window.onload = configPage;
--></script>
<script type="text/javascript">
scrollToNameAnchor();
</script><table class="titleTable" cellpadding="0" cellspacing="0" id="titleTable" style="display:none"><tr><td class="titleTableTitle" align="left">Apache Flex 4.16.1 API Reference </td><td class="titleTableTopNav" align="right"><a href="../../package-summary.html" onclick="loadClassListFrame('../../all-classes.html')">All Packages</a>&nbsp;|&nbsp;<a href="../../class-summary.html" onclick="loadClassListFrame('../../all-classes.html')">All Classes</a>&nbsp;|&nbsp;<a href="../../all-index-A.html" onclick="loadClassListFrame('../../index-list.html')">Index</a>&nbsp;|&nbsp;<a id="framesLink1" href="../../index.html?mx/validators/RegExpValidator.html&amp;mx/validators/class-list.html">Frames</a><a id="noFramesLink1" style="display:none" href="" onclick="parent.location=document.location"> No Frames </a></td><td class="titleTableLogo" align="right" rowspan="3"><img src="../../images/logo.jpg" class="logoImage" alt="AdobeLogo" title="AdobeLogo"></td></tr><tr class="titleTableRow2"><td class="titleTableSubTitle" id="subTitle" align="left">RegExpValidator</td><td class="titleTableSubNav" id="subNav" align="right"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a>&nbsp;| <a href="#eventSummary">Events</a>&nbsp;| <a href="#includeExamplesSummary">Examples</a></td></tr><tr class="titleTableRow3"><td colspan="3">&nbsp;</td></tr></table><script language="javascript" type="text/javascript" xml:space="preserve">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("RegExpValidator"); titleBar_setSubNav(false,true,false,false,false,false,true,false,true,true,false ,false,false,false,false,false);}
-->
</script><div xmlns:fn="http://www.w3.org/2005/xpath-functions" class="MainContent"><table class="classHeaderTable" cellpadding="0" cellspacing="0"><tr><td class="classHeaderTableLabel">Package</td><td><a href="package-detail.html" onclick="javascript:loadClassListFrame('class-list.html')">mx.validators</a></td></tr><tr><td class="classHeaderTableLabel">Class</td><td class="classSignature">public class RegExpValidator</td></tr><tr><td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">RegExpValidator <img src="../../images/inherit-arrow.gif" title="Inheritance" alt="Inheritance" class="inheritArrow"> <a href="../../mx/validators/Validator.html">Validator</a> <img src="../../images/inherit-arrow.gif" title="Inheritance" alt="Inheritance" class="inheritArrow"> flash.events.EventDispatcher</td></tr></table><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p></p><p></p>
The RegExpValidator class lets you use a regular expression
to validate a field.
You pass a regular expression to the validator using the
<code>expression</code> property, and additional flags
to control the regular expression pattern matching
using the <code>flags</code> property.
<p>The validation is successful if the validator can find a match
of the regular expression in the field to validate.
A validation error occurs when the validator finds no match.</p>
<p>The RegExpValidator class dispatches the <code>valid</code>
and <code>invalid</code> events.
For an <code>invalid</code> event, the event object is an instance
of the ValidationResultEvent class, and it contains an Array
of ValidationResult objects.</p>
<p>However, for a <code>valid</code> event, the ValidationResultEvent
object contains an Array of RegExpValidationResult objects.
The RegExpValidationResult class is a child class of the
ValidationResult class, and contains additional properties
used with regular expressions, including the following:</p>
<ul>
<li>
<code>matchedIndex</code> An integer that contains the starting
index in the input String of the match.</li>
<li>
<code>matchedString</code> A String that contains the substring
of the input String that matches the regular expression.</li>
<li>
<code>matchedSubStrings</code> An Array of Strings that contains
parenthesized substring matches, if any. If no substring matches are found,
this Array is of length 0. Use matchedSubStrings[0] to access the
first substring match.</li>
</ul>
<p></p><a name="mxmlSyntaxSummary"></a><span class="classHeaderTableLabel">MXML Syntax</span><span id="showMxmlLink" style="display:none"><a href="#mxmlSyntaxSummary" onclick="toggleMXMLOnly();"><img src="../../images/collapsed.gif" title="collapsed" alt="collapsed" class="collapsedImage">Show MXML Syntax</a><br/></span><span id="hideMxmlLink"><a href="#mxmlSyntaxSummary" onclick="toggleMXMLOnly();"><img src="../../images/expanded.gif" title="expanded" alt="expanded" class="expandedImage">Hide MXML Syntax</a></span><div id="mxmlSyntax" class="mxmlSyntax"> <p>The <code>&lt;mx:RegExpValidator&gt;</code> tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:</p>
<pre>
&lt;mx:RegExpValidator
expression="<i>No default</i>"
flags="<i>No default</i>"
noExpressionError="The expression is missing."
noMatchError="The field is invalid."
/&gt;
</pre>
</div><script language="javascript" type="text/javascript"><!--
setMXMLOnly();
--></script><p><a href="#includeExamplesSummary">View the examples</a></p><p><span class="classHeaderTableLabel">See also</span></p><div class="seeAlso"><a href="RegExpValidationResult.html" target="">mx.validators.RegExpValidationResult</a><br/><a href="ValidationResult.html" target="">mx.validators.ValidationResult</a><br/>RegExp</div><br/><hr></div><a name="propertySummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Properties</div><div class="showHideLinks"><div id="hideInheritedProperty" class="hideInheritedProperty"><a class="showHideLink" href="#propertySummary" onclick="javascript:setInheritedVisible(false,'Property');"><img class="showHideLinkImage" src="../../images/expanded.gif"> Hide Inherited Public Properties</a></div><div id="showInheritedProperty" class="showInheritedProperty"><a class="showHideLink" href="#propertySummary" onclick="javascript:setInheritedVisible(true,'Property');"><img class="showHideLinkImage" src="../../images/collapsed.gif"> Show Inherited Public Properties</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProperty"><tr><th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#enabled" class="signatureLink">enabled</a> : Boolean<div class="summaryTableDescription">
Setting this value to false will stop the validator
from performing validation.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#expression" class="signatureLink">expression</a> : String<div class="summaryTableDescription">
The regular expression to use for validation.</div></td><td class="summaryTableOwnerCol">RegExpValidator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#flags" class="signatureLink">flags</a> : String<div class="summaryTableDescription">
The regular expression flags to use when matching.</div></td><td class="summaryTableOwnerCol">RegExpValidator</td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#listener" class="signatureLink">listener</a> : Object<div class="summaryTableDescription">
Specifies the validation listener.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#noExpressionError" class="signatureLink">noExpressionError</a> : String<div class="summaryTableDescription">
Error message when there is no regular expression specifed.</div></td><td class="summaryTableOwnerCol">RegExpValidator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#noMatchError" class="signatureLink">noMatchError</a> : String<div class="summaryTableDescription">
Error message when there are no matches to the regular expression.</div></td><td class="summaryTableOwnerCol">RegExpValidator</td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#property" class="signatureLink">property</a> : String<div class="summaryTableDescription">
A String specifying the name of the property
of the source object that contains
the value to validate.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#required" class="signatureLink">required</a> : Boolean<div class="summaryTableDescription">
If true, specifies that a missing or empty
value causes a validation error.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#requiredFieldError" class="signatureLink">requiredFieldError</a> : String<div class="summaryTableDescription">
Error message when a value is missing and the
required property is true.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#source" class="signatureLink">source</a> : Object<div class="summaryTableDescription">
Specifies the object containing the property to validate.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#trigger" class="signatureLink">trigger</a> : IEventDispatcher<div class="summaryTableDescription">
Specifies the component generating the event that triggers the validator.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#triggerEvent" class="signatureLink">triggerEvent</a> : String<div class="summaryTableDescription">
Specifies the event that triggers the validation.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr></table></div><a name="protectedPropertySummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Properties</div><div class="showHideLinks"><div id="hideInheritedProtectedProperty" class="hideInheritedProtectedProperty"><a class="showHideLink" href="#protectedPropertySummary" onclick="javascript:setInheritedVisible(false,'ProtectedProperty');"><img class="showHideLinkImage" src="../../images/expanded.gif"> Hide Inherited Protected Properties</a></div><div id="showInheritedProtectedProperty" class="showInheritedProtectedProperty"><a class="showHideLink" href="#protectedPropertySummary" onclick="javascript:setInheritedVisible(true,'ProtectedProperty');"><img class="showHideLinkImage" src="../../images/collapsed.gif"> Show Inherited Protected Properties</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable hideInheritedProtectedProperty" id="summaryTableProtectedProperty"><tr><th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class="hideInheritedProtectedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#actualListeners" class="signatureLink">actualListeners</a> : Array<div class="summaryTableDescription">[read-only]
Contains an Array of listener objects, if any,
or the source object.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProtectedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#actualTrigger" class="signatureLink">actualTrigger</a> : IEventDispatcher<div class="summaryTableDescription">[read-only]
Contains the trigger object, if any,
or the source object.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProtectedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#resourceManager" class="signatureLink">resourceManager</a> : <a href="../../mx/resources/IResourceManager.html">IResourceManager</a><div class="summaryTableDescription">[read-only]
A reference to the object which manages
all of the application's localized resources.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProtectedProperty"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#subFields" class="signatureLink">subFields</a> : Array<div class="summaryTableDescription">
An Array of Strings containing the names for the properties contained
in the value Object passed to the validate() method.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr></table></div><a name="methodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Methods </div><div class="showHideLinks"><div id="hideInheritedMethod" class="hideInheritedMethod"><a class="showHideLink" href="#methodSummary" onclick="javascript:setInheritedVisible(false,'Method');"><img class="showHideLinkImage" src="../../images/expanded.gif"> Hide Inherited Public Methods</a></div><div id="showInheritedMethod" class="showInheritedMethod"><a class="showHideLink" href="#methodSummary" onclick="javascript:setInheritedVisible(true,'Method');"><img class="showHideLinkImage" src="../../images/collapsed.gif"> Show Inherited Public Methods</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableMethod"><tr><th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#RegExpValidator()" class="signatureLink">RegExpValidator</a>()</div><div class="summaryTableDescription">
Constructor
</div></td><td class="summaryTableOwnerCol">RegExpValidator</td></tr><tr class="hideInheritedMethod"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#initialized()" class="signatureLink">initialized</a>(document:Object, id:String):void</div><div class="summaryTableDescription">
Called automatically by the MXML compiler when the Validator
is created using an MXML tag.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedMethod"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#validate()" class="signatureLink">validate</a>(value:Object = null, suppressEvents:Boolean = false):<a href="../../mx/events/ValidationResultEvent.html">ValidationResultEvent</a></div><div class="summaryTableDescription">
Performs validation and optionally notifies
the listeners of the result.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedMethod"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#validateAll()" class="signatureLink">validateAll</a>(validators:Array):Array</div><div class="summaryTableDescription">[static]
Invokes all the validators in the validators Array.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr></table></div><a name="methodSummary"></a><a name="protectedMethodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Methods </div><div class="showHideLinks"><div id="hideInheritedProtectedMethod" class="hideInheritedProtectedMethod"><a class="showHideLink" href="#protectedMethodSummary" onclick="javascript:setInheritedVisible(false,'ProtectedMethod');"><img class="showHideLinkImage" src="../../images/expanded.gif"> Show Inherited Protected Methods</a></div><div id="showInheritedProtectedMethod" class="showInheritedProtectedMethod"><a class="showHideLink" href="#protectedMethodSummary" onclick="javascript:setInheritedVisible(true,'ProtectedMethod');"><img class="showHideLinkImage" src="../../images/collapsed.gif"> Show Inherited Protected Methods</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProtectedMethod"><tr><th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class="hideInheritedProtectedMethod"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#addListenerHandler()" class="signatureLink">addListenerHandler</a>():void</div><div class="summaryTableDescription">
Sets up all of the listeners for the
valid and invalid
events dispatched from the validator.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#doValidation()" class="signatureLink">doValidation</a>(value:Object):Array</div><div class="summaryTableDescription">[override]
Override of the base class doValidation() method
to validate a regular expression.</div></td><td class="summaryTableOwnerCol">RegExpValidator</td></tr><tr class="hideInheritedProtectedMethod"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#getValueFromSource()" class="signatureLink">getValueFromSource</a>():Object</div><div class="summaryTableDescription">
Returns the Object to validate.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProtectedMethod"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#handleResults()" class="signatureLink">handleResults</a>(errorResults:Array):<a href="../../mx/events/ValidationResultEvent.html">ValidationResultEvent</a></div><div class="summaryTableDescription">
Returns a ValidationResultEvent from the Array of error results.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProtectedMethod"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#isRealValue()" class="signatureLink">isRealValue</a>(value:Object):Boolean</div><div class="summaryTableDescription">
Returns true if value is not null.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProtectedMethod"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#removeListenerHandler()" class="signatureLink">removeListenerHandler</a>():void</div><div class="summaryTableDescription">
Disconnects all of the listeners for the
valid and invalid
events dispatched from the validator.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProtectedMethod"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#resourcesChanged()" class="signatureLink">resourcesChanged</a>():void</div><div class="summaryTableDescription">
This method is called when a Validator is constructed,
and again whenever the ResourceManager dispatches
a "change" Event to indicate
that the localized resources have changed in some way.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr></table></div><a name="eventSummary"></a><div class="summarySection"><div class="summaryTableTitle">Events</div><div class="showHideLinks"><div id="hideInheritedEvent" class="hideInheritedEvent"><a class="showHideLink" href="#eventSummary" onclick="javascript:setInheritedVisible(false,'Event');"><img class="showHideLinkImage" src="../../images/expanded.gif"> Hide Inherited Events</a></div><div id="showInheritedEvent" class="showInheritedEvent"><a class="showHideLink" href="#eventSummary" onclick="javascript:setInheritedVisible(true,'Event');"><img class="showHideLinkImage" src="../../images/collapsed.gif"> Show Inherited Events</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable hideInheritedEvent" id="summaryTableEvent"><tr><th>&nbsp;</th><th colspan="2">Event</th><th> Summary </th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class="hideInheritedEvent"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#event:invalid" class="signatureLink">invalid</a></div></td><td class="summaryTableDescription summaryTableCol">Dispatched when validation fails.</td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedEvent"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/validators/Validator.html#event:valid" class="signatureLink">valid</a></div></td><td class="summaryTableDescription summaryTableCol">Dispatched when validation succeeds.</td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr></table></div><a name="protectedConstantSummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Constants</div><div class="showHideLinks"><div id="hideInheritedProtectedConstant" class="hideInheritedProtectedConstant"><a class="showHideLink" href="#protectedConstantSummary" onclick="javascript:setInheritedVisible(false,'ProtectedConstant');"><img class="showHideLinkImage" src="../../images/expanded.gif"> Hide Inherited Protected Constants</a></div><div id="showInheritedProtectedConstant" class="showInheritedProtectedConstant"><a class="showHideLink" href="#protectedConstantSummary" onclick="javascript:setInheritedVisible(true,'ProtectedConstant');"><img class="showHideLinkImage" src="../../images/collapsed.gif"> Show Inherited Protected Constants</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable hideInheritedProtectedConstant" id="summaryTableProtectedConstant"><tr><th>&nbsp;</th><th colspan="2">Constant</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class="hideInheritedProtectedConstant"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#DECIMAL_DIGITS" class="signatureLink">DECIMAL_DIGITS</a> : String = 0123456789<div class="summaryTableDescription">[static]
A String containing the decimal digits 0 through 9.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr><tr class="hideInheritedProtectedConstant"><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/validators/Validator.html#ROMAN_LETTERS" class="signatureLink">ROMAN_LETTERS</a> : String = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz<div class="summaryTableDescription">[static]
A string containing the upper- and lower-case letters
of the Roman alphabet ("A" through "Z" and "a" through "z").</div></td><td class="summaryTableOwnerCol"><a href="../../mx/validators/Validator.html">Validator</a></td></tr></table></div><script language="javascript" type="text/javascript"><!--
showHideInherited();
--></script><div class="MainContent"><div class="detailSectionHeader">Property Detail</div><a name="propertyDetail"></a><a name="expression"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">expression</td><td class="detailHeaderType">property</td></tr></table><div class="detailBody"><code>expression:String</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
The regular expression to use for validation.
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get expression():String</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set expression(value:String):void</code><br/></div><a name="propertyDetail"></a><a name="flags"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">flags</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>flags:String</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
The regular expression flags to use when matching.
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get flags():String</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set flags(value:String):void</code><br/></div><a name="propertyDetail"></a><a name="noExpressionError"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">noExpressionError</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>noExpressionError:String</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Error message when there is no regular expression specifed.
The default value is "The expression is missing."
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get noExpressionError():String</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set noExpressionError(value:String):void</code><br/></div><a name="propertyDetail"></a><a name="noMatchError"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">noMatchError</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>noMatchError:String</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Error message when there are no matches to the regular expression.
The default value is "The field is invalid."
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get noMatchError():String</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set noMatchError(value:String):void</code><br/></div><a name="constructorDetail"></a><div class="detailSectionHeader">Constructor Detail</div><a name="RegExpValidator()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">RegExpValidator</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">Constructor</td></tr></table><div class="detailBody"><code>public function RegExpValidator()</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p>
Constructor
</p></div><a name="methodDetail"></a><div class="detailSectionHeader">Method Detail</div><a name="doValidation()"></a><a name="doValidation(Object)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">doValidation</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td></tr></table><div class="detailBody"><code>override protected function doValidation(value:Object):Array</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Override of the base class <code>doValidation()</code> method
to validate a regular expression.
<p>You do not call this method directly;
Flex calls it as part of performing a validation.
If you create a custom Validator class, you must implement this method. </p>
</p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">value</span>:Object</code> &mdash; Object to validate.
</td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>Array</code> &mdash; For an invalid result, an Array of ValidationResult objects,
with one ValidationResult object for each field examined by the validator.
</td></tr></table></div><a name="includeExamplesSummary"></a><div class="detailSectionHeader">Examples</div><div class="exampleHeader">RegExValidatorExample.mxml</div><div class="detailBody"><div class="listing"><pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--&gt;
&lt;!-- Simple example to demonstrate the RegExpValidator. --&gt;
&lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"&gt;
&lt;fx:Script&gt;
&lt;![CDATA[
import mx.events.ValidationResultEvent;
import mx.validators.*;
// Write the results to the
private function handleResult(eventObj:ValidationResultEvent):void {
if (eventObj.type == ValidationResultEvent.VALID) {
// For valid events, the results Array contains
// RegExpValidationResult objects.
var xResult:RegExpValidationResult;
reResults.text = "";
for (var i:uint = 0; i &lt; eventObj.results.length; i++) {
xResult = eventObj.results[i];
reResults.text=reResults.text + xResult.matchedIndex + " " + xResult.matchedString + "\n";
}
} else {
reResults.text = "";
}
}
]]&gt;
&lt;/fx:Script&gt;
&lt;fx:Declarations&gt;
&lt;mx:RegExpValidator id="regExpV"
source="{regex_text}" property="text"
flags="g" expression="{regex.text}"
valid="handleResult(event)"
invalid="handleResult(event)"
trigger="{myButton}"
triggerEvent="click"/&gt;
&lt;/fx:Declarations&gt;
&lt;s:Panel title="RegExpValidator Example"
width="75%" height="75%"
horizontalCenter="0" verticalCenter="0"&gt;
&lt;s:VGroup left="10" right="10" top="10" bottom="10"&gt;
&lt;s:Label width="100%" text="Instructions:"/&gt;
&lt;s:Label width="100%" text="1. Enter text to search. By default, enter a string containing the letters ABC in sequence followed by any digit."/&gt;
&lt;s:Label width="100%" text="2. Enter the regular expression. By default, enter ABC\d."/&gt;
&lt;s:Label width="100%" text="3. Click the Button control to trigger the validation."/&gt;
&lt;s:Label width="100%" text="4. The results show the index in the text where the matching pattern begins, and the matching pattern. "/&gt;
&lt;mx:Form&gt;
&lt;mx:FormItem label="Enter text:"&gt;
&lt;s:TextInput id="regex_text" text="xxxxABC4xxx" width="100%"/&gt;
&lt;/mx:FormItem&gt;
&lt;mx:FormItem label="Enter regular expression:"&gt;
&lt;s:TextInput id="regex" text="ABC\d" width="100%"/&gt;
&lt;/mx:FormItem&gt;
&lt;mx:FormItem label="Results:"&gt;
&lt;s:TextInput id="reResults" width="100%"/&gt;
&lt;/mx:FormItem&gt;
&lt;mx:FormItem &gt;
&lt;s:Button id="myButton" label="Validate"/&gt;
&lt;/mx:FormItem&gt;
&lt;/mx:Form&gt;
&lt;/s:VGroup&gt;
&lt;/s:Panel&gt;
&lt;/s:Application&gt;
</pre></div><script language="javascript" type="text/javascript"><!-- AC_FL_RunContent( "src", "examples/RegExValidatorExample", "width", "100%",
"height","400px", "salign", "TL", "id", "example1", "quality", "high", "bgcolor", "", "name",
"example1", "flashvars","", "allowScriptAccess","sameDomain", "type",
"application/x-shockwave-flash","pluginspage", "http://www.macromedia.com/go/getflashplayer" ); --></script></div><br/><br/><hr><br/><p></p><center class="copyright"><footer>The Apache Software Foundation</footer><br/>Wed Nov 15 2017, 09:50 AM +01:00 </center></div></body></html><!--The Apache Software Foundation<br/>Wed Nov 15 2017, 09:50 AM +01:00 -->