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 8258765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:39:27+00:00 2026-06-08T02:39:27+00:00

I am trying to find a way to make field constraints for input of

  • 0

I am trying to find a way to make field constraints for input of a phone number.
Example:
France (country code 33) local number 0142687984 should be input as
33142687984

and not for example
00331 42687984, 0033 (1) 42687984, +33 1 42 68 79 84 etc

basically the number should never start with 0, should not include spaces or signs like + ( ) etc and should have at least 9 digits

I have been trying to find a sample for deluge scripting but no success. Please help

I have this so far :

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    // TODO Auto-generated method stub

    String nom = request.getParameter("nom");
    String prenom = request.getParameter("prenom");
    String phone = request.getParameter("phone");
    String adressefacturation = request.getParameter("adressefacturation");
    String ZIPfacturation = request.getParameter("ZIPfacturation");
    String paysfacturation = request.getParameter("paysfacturation");
    String adresseexpedition = request.getParameter("adresseexpedition");
    String ZIPexpedition = request.getParameter("ZIPexpedition");

    String paysexpedition = request.getParameter("paysexpedition");
    String CardNumber = request.getParameter("CardNumber");
    String CardDateOfExpiry = request.getParameter("CardDateOfExpiry");

    String password = request.getParameter("password");         
}
  • 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-08T02:39:29+00:00Added an answer on June 8, 2026 at 2:39 am

    To compute some posibilities you have to split the entered string (after test of “.. (1) ..”):

        // String[] litteralPhone = request.getParameter("phone").split(" ") ;
        final String litteralPhone = "0033 (119999999990";
        final int i = litteralPhone.indexOf(")");
        if (i > 0) {
            if (litteralPhone.substring(i).length() > 8) {
                System.out.println(litteralPhone.replaceAll(
                    "^[0]{1,}|[ ]{0,}\\(|\\)[ ]{0,}", ""));
            } else {
                System.out.println("error with ()");
            }
        } else {
            // suppress trailing ( 
            final String[] tabNum = litteralPhone.replaceAll("\\(|\\)", "").split(" ");
    
            switch (tabNum.length) {
                case 1 : // 003311236549879879
                   tabNum[0] = tabNum[0].replaceAll("^[0]{1,}", "");
                   if (tabNum[0].length() < 10) { // tune this lenght
                          System.out.println("error 1");
                    }
                    break;
                case 2 : // 033 01234567890
                    tabNum[0] = tabNum[0].replaceAll("^[0]{1,}", "");
                    tabNum[1] = tabNum[1].replaceAll("^[0]", "");
                    if (tabNum[1].length() < 8) {
                        System.out.println("error 2");
                    }
                    break;
                case 3 : // +33 1 012346577979
                    tabNum[0] = tabNum[0].replaceAll("^[0]{1,}", "");
                    tabNum[2] = tabNum[2].replaceAll("^[0]", "");
                    if (tabNum[2].length() < 8) {
                        System.out.println("error 3");
                    }
                    // add all cases here
                default :
                    System.out.println("not a good phone number");
                    break;
            }
            final StringBuilder sb = new StringBuilder();
            for (final String string : tabNum) {
                sb.append(string);
            }
            System.out.println(sb.toString());
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find a way to make a list of parent object with
I'm currently trying to find good way to make calls to WCF services in
I'm trying to make a query, but I can't find a way to do
I'm trying to make it same way I made it for boost : find_package(Boost
Trying to find a way to remove blank pages from a document I wrote
Trying to find a way to send a POST HTTPS request from Python to
I am trying to find a way to increment a second primary key column
I am trying to find a way to reverse a string, I've seen alternatives
I am trying to find a way to prevent the keyboard from appearing when
I'm trying to find a way to my Window 7 machine to recognize the

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.