how to split into character group? [duplicate]
I want to split string
"abcde开发者_StackOverflow中文版fgh"
to
"ab","cd","ef","gh"
using javascript split()
"abcdefgh".split(???)
Can you please help ?
Instead of split
, try match
:
var text = "abcdefgh";
print(text.match(/../g));
prints:
ab,cd,ef,gh
as you can see on Ideone.
精彩评论