I'm trying to come up with the optimal solution for validating IP addresses in Adobe Flex. My current solution is to use a regexp validator and look for dotted quad numbers, see code below. For some reason this will also allow an address like "1.2.3.4.5". Does anyone have a better solution out there?
<?xml version="1.0" encoding="utf-8"?>
<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" minWidth="955" minHeight="600">
    <fx:Script>
        <![CDATA[
            import mx.controls.Alert;
        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
        <mx:RegExpValidator source="{ipAddr}" property="text" 
                            expression="\d+\.\d+\.\d+\.\d+" 
                            invalid="Alert.show('The IP address is invalid');"/>        
    </fx:Declarations>
    <s:TextInput id="ipAddr" x="10" y="10"/>
    <s:Button label="OK" x="10" y="40"/>
</s:Application>
 
     
    