title: How to use the string.match method to find multiple occurrences of the same word in a string?
body: <p>In Actionscript and Adobe Flex, I'm using a pattern and regexp (with the global flag) with the string.match method and it works how I'd like except when the match returns multiple occurrences of the same word in the text.  In that case, all the matches for that word point only to the index for the first occurrence of that word.  For example, if the text is "cat dog cat cat cow" and the pattern is a search for cat*, the match method returns an array of three occurrences of "cat", however, they all point to only the index of the first occurrence of cat when i use indexOf on a loop through the array.  I'm assuming this is just how the string.match method is (although please let me know if i'm doing something wrong or missing something!).  I want to find the specific indices of every occurrence of a match, even if it is of a word that was already previously matched.</p>
  
  <p>I'm wondering if that is just how the string.match method is and if so, if anyone has any idea what the best way to do this would be.  Thanks.</p>