Welcome, Guest. Please login or register.
Did you miss your activation email?
10 Mar 2010, 08:26:46 UTC
Forum home
+  flexdeveloper.eu Forum
|-+  Flex and ActionScript 3.0
| |-+  ActionScript 3.0 (Moderators: JMWhittaker, Jan K, thewarpedcoder, James)
| | |-+  Regular expressions
« previous next »
Pages: [1] Print
Author Topic: Regular expressions (Read 5650 times)
zoidberg
Newbie FD
*
Posts: 8



« on: 09 Feb 2007, 09:48:10 UTC »

hello,

so i have made a user input form and done a lot of custom regular expressions for inputs like uk telephone number, uk postcode and credit card number but now i want to make a regular expression to gaurd against malicious code and SQL injections.  I have come up with a code but i dont know how to make the <mx:RegExp> to make sure if the user matches the expression the data is not accepted instead of only allowing the data if it matches!!

so basically, i'm trying to say the expression is NOT allowed instead of allowed

cheers
Logged
flexy
flexdeveloper.eu
Guru/Addict FD
*****
Posts: 2,837


Recovering Coffee Addict & Adobe Expert


WWW
« Reply #1 on: 12 Feb 2007, 15:38:00 UTC »

Using AS, you can define a function that returns either true or false surely?

Code:
       private function validateEmail(str:String):Boolean {
            var pattern:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
            var result:Object = pattern.exec(str);
            if(result == null) {
                return false;
            }
            return true;
        }
Logged

Pages: [1] Print
« previous next »
Share this on: Twitter Twitter Del.icio.us del.icio.us Digg Digg
Jump to:

©2006-2010 Flexdeveloper.eu/Jodie O'Rourke. All rights reserved.
Adobe®, Adobe® Flash™, Adobe® AIR™ and Adobe® Flex™ are registered trademarks of Adobe Systems Incorporated in the United States and other countries. All rights reserved.

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC