Skip to content

Instantly share code, notes, and snippets.

@songjiayang
Created September 15, 2014 06:35
Show Gist options
  • Save songjiayang/2932ac9dbc89a806696b to your computer and use it in GitHub Desktop.
Save songjiayang/2932ac9dbc89a806696b to your computer and use it in GitHub Desktop.
Javascript中如何忽略大小写正则匹配动态字符串。
key_word = "foo"
re = new RegExp(key_word, "i")
"Foo".match(re)
@lfjs
Copy link

lfjs commented Sep 30, 2017

nice,但是怎么怎么让他又g又i??

@lfjs
Copy link

lfjs commented Sep 30, 2017

well,believe or not
console.log('style1style2Style3style4'.match(/style/gi));
is working..............
as well as
/style/ig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment