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

  • SEARCH
  • Home
  • 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 8384971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:32:55+00:00 2026-06-09T17:32:55+00:00

Here I want validation for the mobile number start with +91 and after 10

  • 0

Here I want validation for the mobile number start with +91 and after 10 digit number.
I am add the +91 pincode into edittext like:

edtmobile.append("+91(-)"); so when display the edittext(UI) there is already +91and after edit 10 digit number

I am using Reg Ex like :

String regExPhone = "(+91(-)?|91(-)?|0(-)?)?[0-9]{10}";

but got the error like :

E/AndroidRuntime( 1411): java.util.regex.PatternSyntaxException: Syntax error U_REGEX_RULE_SYNTAX near index 2:
E/AndroidRuntime( 1411): (+91(-)?|91(-)?|0(-)?)?[0-9]{10}
E/AndroidRuntime( 1411):   ^

Please let me know where I do mistake, and there is another solutions for same.

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-09T17:32:56+00:00Added an answer on June 9, 2026 at 5:32 pm

    + is a special character in regex and needs escaping

    try

    String regExPhone = "(\+91(-)?|91(-)?|0(-)?)?[0-9]{10}";
    

    you also do not need to group single characters to make them optional, so

    String regExPhone = "(\+91-?|91-?|0-?)?[0-9]{10}";
    

    would be the same.

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

Sidebar

Related Questions

I use Rails 3.0.0.beta4 I want to add a validation on uniqueness on two
I've read the Django documentation here: http://docs.djangoproject.com/en/dev/ref/forms/validation/ I've also browsed a number of search
I'm doing some file validation and want to load an UploadedFile into an external
I am trying to do some EditText validation and want to use an AlertDialog
<pre> <script> // here i want to check form validation //if i use for
I want make validation jquery without using from plugin , problem is here that
i want to set numeric as well as password validation in TextField. here is
After I run .validate(), I want to do something if the validation fails. $(document).ready(function
I want to exclude spaces when validating a textbox in vb.net. Here is the
enter code here Want to remove items from a Main list , but give

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.