var str = '0123456789'; console.log( str.match(new RegExp('[0-9]', 'g')), str.match(/[\uff10-\uff19]/g) ); //returns ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] both ways
Be sure to save the .js file with the correct encoding (UTF-8) if you are using a non-episized version.
source share