[SP-pm] Contando caracteres em regexp

Eden Cardim edencardim at gmail.com
Mon Jul 26 14:23:20 PDT 2010


2010/7/26 Pinguim Azul <bluepenguin em gmail.com>:
> Tem algum jeito de contar os caracteres de uma regexp sem usar o length?
>
> Por exemplo:
>
> $_="aaaaaaaaaa";s/a+/length$&/e;print

perl -le'$_=q{aaaaaa};s/(a(?{$c++}))*/$c/e;print'

-- 
   Eden Cardim       Need help with your Catalyst or DBIx::Class project?
  Code Monkey                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://blog.edencardim.com/            http://www.shadowcat.co.uk/servers/


More information about the SaoPaulo-pm mailing list