in reply to Counting frequency of expressions in a string

Your re needs to have a 'g' after the final slash. So: /Perls\sin\sParty/g for example. The 'g' stands for "global". I'm thinking I'm overlooking something else, but at this hour my poor brain is a bit fried. Hope this helps you.