RFC 110 (v2) counting matches

[email protected] (Perl6 RFC Librarian)
Newsgroups perl.perl6.language.regex,perl.perl6.announce
Message-ID <[email protected]>
This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1	TITLE

counting matches

=head1 VERSION

	Maintainer: Richard Proctor <[email protected]>
	Date: 16 Aug 2000
	Last Modified: 27 Aug 2000
	Version: 2
	Mailing List: [email protected]
	Number: 110

=head1 ABSTRACT

Provide a simple way of giving a count of matches of a pattern.

=head1 CHANGES

Version 2 of this RFC redirects discussion of this topic to
[email protected].

=head1 DESCRIPTION

Have you ever wanted to count the number of matches of a patten?  s///g 
returns the number of matches it finds.  m//g just returns 1 for matching.
Counts can be made using s//$&/g but this is wastefull, or by putting some 
counting loop round a m//g.  But this all seams rather messy. 

m//gt would be defined to do the match, and return the count of matches, this 
leaves all existing uses consistent and unaffected.  /t is suggested for
"counT", as /c is already taken.  Using /t without /g would be result in
only 0 or 1 being returned, which is nearly the existing syntax.

(Note I am only on the announce list at present as I am suffering
from negative free time).

=head1 IMPLENTATION

No idea

=head1 REFERENCES

I brought this up on p5p a couple of years ago, but it was lost in the noise...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.