How can I use Regular Expression to match Chinese characters like ,。‘;’

652 Views Asked by At

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?

1

There are 1 best solutions below

0
gzc On BEST ANSWER

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