Data Model Flex



    
        
        import mx.events.ValidationResultEvent;
        import mx.validators.RegExpValidationResult;
        import mx.controls.Alert;
        private function handleValidation(event:ValidationResultEvent):void
        {
            var oneResult:RegExpValidationResult;
            for (var i:int = 0; i < event.results.length; i++)
            {
                oneResult = event.results[i];
                Alert.show("matched Index:" + oneResult.matchedIndex +
                           "\nmatched string:" + oneResult.matchedString
                           ,"RegEx Results",Alert.NONMODAL);
            }
        }
      
    

                            property="text" 
                        flags="gmi" 
                        valid="handleValidation(event)" 
                        expression="m[ai]n"
                        noMatchError="I don't like it!" 
                        trigger="{submitButton}"
                        triggerEvent="click" />