From: Christopher Causer Date: 2008-02-11T23:24:04+09:00 Subject: Return number of matches This seems like an easy question but I cannot find any documentation on it anywhere on the web. I want to write a script that will count the number of dollars in a string, excluding escaped dollars (ie. "\$".) My first hack was to use split and count the number of elements in the array, but I came unstuck trying to exclude \$. Surely there's a nice simple elegant solution? I'm very (as in this morning) new to Ruby so apologies if this is a trivial question and I'm posting on the wrong forum. Chris -- Posted via http://www.ruby-forum.com/.