Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7959525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:35:15+00:00 2026-06-04T04:35:15+00:00

if (password1.length() >= 15){ final String PasswordPattern = ^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])[0-9A-Za-z]{15,}$; Pattern pattern = Pattern.compile(PasswordPattern); Matcher

  • 0
                if (password1.length() >= 15){          
                    final String PasswordPattern = "^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])[0-9A-Za-z]{15,}$";

                    Pattern pattern = Pattern.compile(PasswordPattern);
                    Matcher matcher = pattern.matcher(password1);   

                    if(matcher.matches() == true){                      

                        if (password1.equals(password2)){
                            SavePreferences(password1.toString());
                            //Intent intent = new Intent(LockAppActivity.this, ScreenLockActivity.class);
                            Intent intent = new Intent(LockAppActivity.this, PhoneNumActivity.class);
                            startActivity(intent);
                        }
                        else{
                            pass1.setText("");
                            pass2.setText("");
                            Toast.makeText(LockAppActivity.this,"Both passwords are not equal!",Toast.LENGTH_SHORT).show();
                        }
                    }

I want user to enter password with at least 15 characters which must consists of Capital and Small letters, numbers and symbols. But I only know how to create pattern with Capital and Small letters and numbers… How can I include all the symbols in the pattern… Kindly check on my pattern code part… thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:35:16+00:00Added an answer on June 4, 2026 at 4:35 am

    You could add the section (?=.*(\W|_)) to check for anything except alphanumeric (A-Z, a-z, 0-9) symbols. Or, you could specify a set of symbol characters like (?=.*[\.\*]). If you do, replace the contents of the [] with all the characters you want to allow, using a backslash before each character that has a regex function. (The example shows a section that allows two characters, . and *.)

    Then you’ll need top update the section that counts the number of occurrences. Since we’re dealing with all characters now, we can replace the [0-9A-Za-z] with ., leaving us with: ^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*(\W|_)).{15,}$. Replace the single \ with two \\ since you’re placing this in a Java string.

    Remember that Android keypads can vary, so not all of them are guaranteed to have the same symbols.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I validate a surname field like this validates :surname, :presence => true, :length =>
public class main extends Activity { EditText username,password1; Button sub; String uname,pass; @Override public
I have the following password requirements: 1) Should be 6-15 characters in length 2)
I get the following error when I try to compile my C# program: The
We are having difficulty decrypting a string in ColdFusion that was previously encrypted with
I have set up a UDP client/server model that can send string messages to
We've a login form and our minimum password length is 8 chars. So when
Final Update: There was a stray LoadModule python_module modules/mod_python.so that conflicted with mod_wsgi .
I want my home clear of all W3C errors. I have one final error:
I needed some simple string encryption, so I wrote the following code (with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.