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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:39:55+00:00 2026-05-13T05:39:55+00:00

Greetings, I am developing GWT application where user can enter his details in Japanese.

  • 0

Greetings,

I am developing GWT application where user can enter his details in Japanese.
But the ‘userid’ and ‘password’ should only contain English characters(Latin Alphabet).
How to validate Strings for this?

  • 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-05-13T05:39:56+00:00Added an answer on May 13, 2026 at 5:39 am

    You can use String#matches() with a bit regex for this. Latin characters are covered by \w.

    So this should do:

    boolean valid = input.matches("\\w+");
    

    This by the way also covers numbers and the underscore _. Not sure if that harms. Else you can just use [A-Za-z]+ instead.

    If you want to cover diacritical characters as well (ä, é, ò, and so on, those are per definition also Latin characters), then you need to normalize them first and get rid of the diacritical marks before matching, simply because there’s no (documented) regex which covers diacriticals.

    String clean = Normalizer.normalize(input, Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
    boolean valid = clean.matches("\\w+");
    

    Update: there’s an undocumented regex in Java which covers diacriticals as well, the \p{L}.

    boolean valid = input.matches("\\p{L}+");
    

    Above works at Java 1.6.

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

Sidebar

Related Questions

Greetings friends, I am developing a web application that will allow the customer to
Greetings all, We are developing a QT application (QT 4.6 LGPL version) in Linux
Greetings, We are developing a scientific QT Application which detect the border of a
Greetings, I am developing some application in C#. At the moment I'm dealing with
Greetings, we are a the moment developing a website for intranet use. The user
Greetings, Currently I am in process of developing an application for booking (etc. rooms).
Greetings! I am developing Asp.net application, in which i need to use sqlite as
I am developing a greeting card application. Greeting card should be posted to multiple
Greetings, Currently developing small web service application where response from web service (using CXF
Greetings Friends, I am trying to overlay the simple 2D game I am developing

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.