raul
raul

Reputation: 1269

Two modifiers with String.prototype.match()

I've looked far and wide but couldn't figure this out: How can I use two modifiers, say i and g, with String.prototype.match()?

I have this: var spChar = string.match(/[.:hm]/g); How can I add the i modifier too?

Upvotes: 0

Views: 67

Answers (2)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

You can write after or before g, the ordering is not necessary:

var spChar = string.match(/[.:hm]/gi);

Upvotes: 3

Pointy
Pointy

Reputation: 413712

Just put both modifiers there:

var spChar = string.match(/[.:hm]/ig);

Upvotes: 3

Related Questions