From: Sam Morrison Date: 2007-07-27T22:26:50+09:00 Subject: Re: Regexp's comparison ------=_Part_5936_2957084.1185542813582 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/27/07, Marcin Tyman wrote: > > > Assume that a, b, c, d etc.. represent one line in iptable (one entry - > a for IP = x.x.x.x, b for y.y.y.y etc). I need to check whether 3 (not > only one and no more than 3) rules for ip x.x.x.x are in iptables but > these rules (lines) each time may be in different positions (other rules > may be placed between them etc...) You can do the scan with lenght, like this: text = "adcdcbcdc" text.scan(/c/).length this will return the total times c shows up in your string. -- sam ------=_Part_5936_2957084.1185542813582--