Try to search your question here, if you can't find : Ask Any Question Now ?

Regular expression to match with chienese characters in javascript

HomeCategory: stackoverflowRegular expression to match with chienese characters in javascript
kundan asked 4 days ago

I have a regular expression /s*,s*/ that matches left spaces followed by comma then right spaces.

Example:

var str = "john,walker    james  , paul";
var arr = str.split(/s*,s*/);
Values in arr = [john,walker james,paul] // Size: 3

Example with Chinese characters:

var str = "继续,取消   继续 ,取消";
var arr = str.split(/s*,s*/);
Values in arr = ["继续,取消   继续 ,取消"] // Size: 1, All values at index 0 no splitting happened

Tried splitting characters with unicodes:

var str = "john,walker    james  , paul";
var arr = str.split(/u0020*u002Cu0020*/);
Values in arr = [john,walker james,paul] // Size: 3

var str = "继续,取消   继续 ,取消";
var arr= str.split(/u0020*u002Cu0020*/);
Values in arr = ["继续,取消   继续 ,取消"] // Size: 1, All values at index 0 no splitting happened

I went through this link but not much info was there that I can use in my scenario. Is it really impossible to create regex for Chinese characters and split them?

1 Answers
Best Answer
Jyoti answered 4 days ago
Your Answer

6 + 14 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com