Results 1 to 6 of 6

Thread: Validate the input

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2004
    Posts
    176

    Validate the input

    Hi,
    I have a password textbox on my form. My requirement is that the password should have atleast 2 digits and 1 special character. I tried implementing it with a RegularExpressionValidator with the validation expression defined as
    [a-zA-Z]*[!@#$%^&*_+|\=-]{1,}[\d]{2,}
    The problem with this expression is that this requires the input to have the same order of characters while i would like the characters to be allowed in any order. As long as there are 2 digits and 1 spl character it should accept.
    Thanx in advance

  2. #2
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Validate the input

    Well a simple solution would be to have 2 counters one for digits and another for special characters.... Just browse the string and increase the counters acordingly.

    Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2004
    Posts
    176

    Re: Validate the input

    Thanx Jorge,
    but i m looking for a regular expression because my requirement with the password may change & changing the code at a later time might not be advisable.
    m still on the lookout for a reg exp. any help?

  4. #4
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: Validate the input

    Hi,

    I'm really poor at RegEx, but perhaps this could help.

    Cheers,
    NTG
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  5. #5
    Member seraphicmortal's Avatar
    Join Date
    May 2005
    Posts
    56

    Smile Re: Validate the input

    I don't know if this helps, but check (anotherVBnewbie post) this out.


    http://www.vbforums.com/showthread.p...=1#post2022318
    Yoroshiku,
    seraphicmortal


    ______________________________________________________
    Thirst for knowledge can never be quenched...Ask for more!!.


    Oh! Please..Show your appreciation by clicking if you deem this post helpful.
    Rate this Post!

  6. #6
    Member seraphicmortal's Avatar
    Join Date
    May 2005
    Posts
    56

    Smile Re: Validate the input

    I don't know if this helps, but check (anotherVBnewbie post) this out.

    http://www.vbforums.com/showthread.p...=1#post2022318
    Yoroshiku,
    seraphicmortal


    ______________________________________________________
    Thirst for knowledge can never be quenched...Ask for more!!.


    Oh! Please..Show your appreciation by clicking if you deem this post helpful.
    Rate this Post!

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