On Fri, 22 Jun 2001, Bradford Ritchie wrote: > Does anyone know how to count the number of times a regex (global) matches? > > According to the docs, m/$pattern/g will return true (which I think is > "1") upon success, but not the nubmer of times matched. > > I tried the following: > $count = @matches = /$pattern/g; > > and this works, but it seems like there must be a more straightforward > way to do it. $count = () = /$pattern/g; I think accomplishes the same thing. -- Brett http://www.chapelperilous.net/btfwk/ ------------------------------------------------------------------------ If you aren't rich you should always look useful. -- Louis-Ferdinand Celine
- determining largest in a set of variables Aaron Lawson
- Re: determining largest in a set of variables Brett W. McCoy
- Re: determining largest in a set of variables Paul Johnson
- Re: determining largest in a set of variables Jeff 'japhy' Pinyan
- How do I determine number of matches in a regex? Bradford Ritchie
- Re: How do I determine number of matches in a... Brett W. McCoy
- Re: How do I determine number of matches ... Bradford Ritchie
- Re: How do I determine number of matc... Brett W. McCoy
- Re: How do I determine number of... Rogério Brito
- Re: How do I determine numbe... Michael Fowler
- Re: How do I determine n... Rogério Brito
- Re: How do I determine n... Michael Fowler
- With perl, don't expect consiste... Me
- Re: With perl, don't expect ... Brett W. McCoy
- Re: How do I determine number of matches in a... Jeff 'japhy' Pinyan
- Re: How do I determine number of matches ... Chas Owens