javascript - Check for unicode range with CasperJS -


i trying check chinese characters using unicode range[\u4e00-\u9fa5] casperjs script failing.

this attempting do,

casper.test.begin('unicode test', 1, function(test) {     casper.start('http://us.weibo.com/gb', function(){         test.assertmatch(/[\u4e00-\u9fa5]/, 'checking ch characters');     }).run(function() {         test.done();     }); }); 

this portion of test results,

details 1 failed test:

in check-for-ch-char.js:628   unicode test     uncaughterror: invalid regexp. 

if copy/paste characters start url can see unicode range works here using regexr.

i think figured out. not sure why, new casperjs if can elaborate on useful.

i edited test test.assertmatch(this.page.content, /[\u4e00-\u9fa5]/, 'checking ch characters'); , did looked content match unicode range against. before, had test.assertmatch(/[\u4e00-\u9fa5]/, 'checking ch characters'); , range not looking @ anything, thought looking @ start url content automatically.

so, including this.page.content did trick seems.


Comments