[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to find out the number of pattern matched?

Li Chen

8/3/2007 6:47:00 PM

Hi all,

I search a pattern in a string. How do I know how many times the pattern
is found/matched?

Thanks,

Li
--
Posted via http://www.ruby-....

3 Answers

Sebastian Hungerecker

8/3/2007 7:03:00 PM

0

Li Chen wrote:

> I search a pattern in a string. How do I know how many times the pattern
> is found/matched?

string.scan(pattern).length

HTH,
Sebastian
--
Jabber: sepp2k@jabber.org
ICQ: 205544826

Li Chen

8/3/2007 9:34:00 PM

0

Sebastian Hungerecker wrote:
> Li Chen wrote:
>
>> I search a pattern in a string. How do I know how many times the pattern
>> is found/matched?
>
> string.scan(pattern).length
>
> HTH,
> Sebastian

Thanks,

Li
--
Posted via http://www.ruby-....

Nadegda

11/10/2012 4:37:00 AM

0

On Tue, 06 Nov 2012 08:30:57 -0500, _kookmeister_ wrote:

> so...?... paula.
> as has been your other strawhouse of
> astrophysics - all the work of a pompous prevaricating purulently
> psychotic pilgarlic phreak [EFG]

Sez the pusillanimous peabrained poltroon while projecting prolifically.

> i have just read where paula claims ownership of an older style vehicle
> with an ignition key "lamp check" position.

MID, kooky, and proof the poster is "paula"?

> paula drives a volatile vulva?
>
> [sno<SLAP!>

Shaddup, kook.