From what I learn of regular expressions, I never heard of the term "greedy," but rather: The g means global search flag that makes the search for regex pattern throughout the string, creating an array of all occurrences it can find matching the given pattern. And yes, it will work with or without it in the regex string RusselB has provided.