1Besides the regular expressions, flags can also be used to help developers with pattern matching.
2/* matching a specific string */
3regex = /sing/; // looks for the string between the forward slashes 9case-sensitive)… matches “sing”, “sing123”
4regex = /sing/i; // looks for the string between the forward slashes (case-insensitive)... matches "sing", "SinNG", "123SinNG"
5regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
6/* groups */
7regex = /it is (sizzling )?hot outside/; // matches "it is sizzling hot outside" and "it is hot outside"
8regex = /it is (?:sizzling )?hot outside/; // same as above except it is a non-capturing group
9regex = /do (dogs) like pizza 1/; // matches "do dogs like pizza dogs"
10regex = /do (dogs) like (pizza)? do 2 1 like you?/; // matches "do dogs like pizza? do pizza dogs like you?"
11/* look-ahead and look-behind */
12regex = /d(?=r)/; // matches 'd' only if it is followed by 'r', but 'r' will not be part of the overall regex match
13regex = / (?<=r)d /; // matches 'd' only if it is proceeded by an 'r', but 'r' will not be part of the overall regex match