RegExpValidator matches text against a RegEx pattern
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:RegExpValidator source="{ssn}"
property="text"
flags="gmi"
expression="\d\{3\}.\d\{2\}.\d\{4\}"
noMatchError="Your SSN is unrecognized."
trigger="{submitButton}"
triggerEvent="click" />
<mx:Text text="Social Security Number:" />
<mx:TextInput id="ssn" />
<mx:Button label="Submit" id="submitButton" />
</mx:Application>
Related examples in the same category