RegExpValidator matches text against a RegEx pattern : RegExpValidator « Data Model « Flex






RegExpValidator matches text against a RegEx pattern

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

1.Using RegExpValidator to find all the matches on the patternUsing RegExpValidator to find all the matches on the pattern
2.Use regular expression ABC\d to match a pattern consisting of the letters A, B, and C in sequence followed by any digitUse regular expression ABC\d to match a pattern consisting of the letters A, B, and C in sequence followed by any digit