Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 625
  • Last Modified:

regular expression with chinese characters

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
mmingfeilam
Asked:
mmingfeilam
  • 4
1 Solution
 
CEHJCommented:
Chinese characters not a problem - see example below

Russian won't be a problem either
chin.png
0
 
mmingfeilamAuthor Commented:
Can you do an example using reg ex?  Not sure if string replacement is the same as regular expression.
0
 
CEHJCommented:
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
 
CEHJCommented:
boolean valid = s.matches(.*"[~!@#$%^&*()_+-=\\]\\[|}{‘;”:/.,?><].*)";

Open in new window

would do it if that IS the case
0
 
CEHJCommented:
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now