var re = /regexp/;
Given the string “example1 Example2 EXAMPLE3”, the following regular expressions match as listed below:
/Example[0-9]+/ // Matches “Example2”
/Example[0-9]+/i // Matches “example1”
/Example[0-9]+/gi // Matches “example1”, “Example2” and “EXAMPLE3”
As seen in the previous examples, the use of “i” and “g” modifiers increases noticeably the matching capabilities of regular expressions. So don’t forget they exist when you code your next script.