A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Regular expression

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    17

    Regular expression

    Hello, I am trying to validate a password that must be at least 2 letters, 2 numbers and at least 8 characters. I created this regular expression:

    Code:
    function validar_Pass(passVal:String):Boolean{
        var pw:RegExp = /^?=.{8,}[A-Za-z]{2,}[0-9]{2,}/;
            return(pw.test(passVal));   
    }
    But it didn't validate.

    What did I do wrong?

    Thank you.

  2. #2
    Junior Member
    Join Date
    Apr 2011
    Posts
    17
    This should work, isn't it? Or is there any mistake in the code?

  3. #3
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    What did I do wrong?
    Here is the summary I hate people like you who judge my favorite password.

    But seriously, check out http://regexpal.com/ for testing your regular expressions.

    For your specific example, ?= means "followed by", right, so there must be something before ?= and that something would be a match, not stuff after ?=
    who is this? a word of friendly advice: FFS stop using AS2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center