From: Marcin Tyman Date: 2007-07-27T22:30:34+09:00 Subject: Re: Regexp's comparison Sam Morrison wrote: > 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. Yeah, I've found it. Thanks for help. I think this would solve all issues in my code. -- Posted via http://www.ruby-forum.com/.