Skip to content

Instantly share code, notes, and snippets.

@zhangkn
Created May 21, 2018 12:47
Show Gist options
  • Save zhangkn/c45a676bfdec250d8e85c2f038625931 to your computer and use it in GitHub Desktop.
Save zhangkn/c45a676bfdec250d8e85c2f038625931 to your computer and use it in GitHub Desktop.
//生成 regexp 对象需要使用 getRegExp函数。
getRegExp(pattern[, flags])
//参数:
//pattern: 正则表达式的内容。
//flags:修饰符。该字段只能包含以下字符: g: global ; i: ignoreCase ; m: multiline。
// 示例代码:
var a = getRegExp("x", "img");
console.log("x" === a.source);
console.log(true === a.global);
console.log(true === a.ignoreCase);
console.log(true === a.multiline);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment