Solved

regular expression with chinese characters

Posted on 2013-06-21
5
545 Views
Last Modified: 2013-07-22
i want to come up with regular expression that excludes these characters:

`~!@#$%^&*()_+-=\][|}{‘;”:/.,?><

but whatever i come up with also excludes foreign language characters such as chinese or russian:

¿¿¿¿¿¿¿ ¿¿¿¿¿¿¿¿¿

can someone tell me if regular expression is the best way to handle this type of situations?  thanks.
0
Comment
Question by:mmingfeilam
  • 4
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 39267117
Chinese characters not a problem - see example below

Russian won't be a problem either
chin.png
0
 

Author Comment

by:mmingfeilam
ID: 39267342
Can you do an example using reg ex?  Not sure if string replacement is the same as regular expression.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39267350
Yes, it is the same essentially. Is what you're after to test if the string includes any characters that should be excluded and to declare it invalid otherwise?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 39267376
boolean valid = s.matches(.*"[~!@#$%^&*()_+-=\\]\\[|}{‘;”:/.,?><].*)";

Open in new window

would do it if that IS the case
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39344147
:)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Do you hate spam? I do, and I am willing to bet you do as well. I often wonder, though, "if people hate spam so much, why do they still post their email addresses on the web?" I'm not talking about a plain-text posting here. I am referring to the fa…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now