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 ?

0

1 Answer 1

6

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

if(valeu.match(new RegExp(x, "ig"))
                         -----^-----
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.