Skip to main content

match

  • it is a cool function it would come after the string (what a gentleman!)

  • it will return an array of matching characters

copy paste the code and run it in your browser

console.log("gaurav gaurav gaurav".match(/gaurav/));

how to ignore lowercase and uppercase

  • well add a /gi here to igonre things here.

well it is same with test in many cases

/[0-9]/ => this will end up in matching all 0-9 characters : )

/[a-z0-9]/ => this will match all letters and numbers

how to ignore some characters like my ex ignore me

/^[aeiou]/gi this would ignore all the vowels