javascript分割字符串,将汉字和非汉字分割出来,'张sdf四上法asdf翁芬aa33网s'.split(/([\u4e00-\u9fa5]{1})/gi);但返回的结果数组里却多出来几个空字符串:["","张","sdf","四","","上","","法","asdf","翁","","芬","aa33","网","s"]请问这个空字符串是怎么出来的?应该如何去除?首页感谢@KevinYue和@皓矾的回答,我的需求其实是把单个汉字分割出来,而且汉字和非汉字的分割要保证顺序,其实我也有其他的方法做,但我真正的问题是:原来的正则表达式为什么会多出几个空字符串?我一直没想明白,所以期望有人能解释一下。
手掌心
相关分类