-2

I'm using javascript to convert string to what I want!! Can I use Regular Expression and use what Regular Expression?? Is there anyone that can help me?

pickline
  • 1
  • 2
  • 1
    Checkout http://stackoverflow.com/questions/150033/regular-expression-to-match-non-english-characters Chinese characters are basically Unicode cahracters. – Tejas Kale May 21 '17 at 07:55

1 Answers1

0

First, you need to get corresponding Unicode code for these Chinese characters. Here is a helpful tool.

character code(base 10) code(hex)
, 65307 0xff1b
。 65292 0xff0c
; 12290 0x3002

Second, use these Unicode code to form regexp.

js:

/[\u3002\uff0c\uff1b]/.test('A string contains Chinese character。')
true
gzc
  • 8,180
  • 8
  • 42
  • 62