Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 607
  • 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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

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