How to pass a variable to split () in javascript
This question already has an answer here:
使用正则表达式对象并试试这个:
var modifiers = "gi"
var patt = new RegExp(term,modifiers);
var textSplit = text.split(patt);
var term = /TO/gi;
var textSplit = text.split(term);
链接地址: http://www.djcxy.com/p/76838.html