in reply to Re^3: Am I doing Greedy Matching?
in thread Am I doing Greedy Matching?

Ah Perfect! I think I had missed the /g and hence the array with only one record. What you suggested worked perfectly! Thanks!

I tried out the other responses as well.. they work too. I liked the simplicity of the foreach method - easy to understand, but its kinda long to type. I keep very descriptive variable names so as to make the code (variables and their purpose) easy to understand by another person who;s looking at my code. In fact, it helps me too, if I have to revisit my code after a year or two.

Thanks all for your suggestions! Truly and highly appreciate your contributions :-)