Search code examples
javascriptjqueryregexuppercaselowercase

Javascript regex for upper- and lowercase match


I have a text box in my web form. In jQuery I have to verify that the entered text should have at least one lowercase and one uppercase letter. How does the pattern look?


Solution

  • /[a-z].*[A-Z]|[A-Z].*[a-z]/
    

    Test here: http://www.regular-expressions.info/javascriptexample.html (without the /)