3

Possible Duplicate:
Case insensitive regex in javascript

Values could be:

- Mike liam

- Joe mike

- Mondal mike effron

I want to mach every value contains 'mike' - case-insensitive

So, I tried:

var x = "mike";
if(valeu.match(new RegExp(x, "g"))
alert('success');

but that didn't work. any ideas ?

Community
  • 1
  • 1
Shadin
  • 1,867
  • 5
  • 26
  • 37

1 Answers1

6

You want the i flag (for "insensitive"):

if(valeu.match(new RegExp(x, "ig"))
                         -----^-----
Cameron
  • 96,106
  • 25
  • 196
  • 225