[SP-pm] Contando caracteres em regexp

Pinguim Azul bluepenguin at gmail.com
Mon Jul 26 14:45:16 PDT 2010


length tem 6 letras, é muito comprido :)

2010/7/26 Nuba Princigalli <nuba at fastmail.fm>:
> voce pode casar com o final da string e consultar a posicao onde houve o
> match
> com http://perldoc.perl.org/functions/pos.html
>
> algum motivo em particular para nao usar o length?
>
> On Mon, 26 Jul 2010 18:11 -0300, "Pinguim Azul" <bluepenguin at gmail.com>
> wrote:
>> Tem algum jeito de contar os caracteres de uma regexp sem usar
>> o length?
>>
>> Por exemplo:
>>
>> $_="aaaaaaaaaa";s/a+/length$&/e;print
>>
>> Isso retorna 10, mas eu queria uma versão sem o length, se possível.
>>
>> --
>> Ricardo Bittencourt http://www.ricbit.com
>> _______________________________________________
>> SaoPaulo-pm mailing list SaoPaulo-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>>
> --
> Nuba R. Princigalli  nuba at pauleira.com  http://pauleira.com  @nprincigalli
> Discipline is not an end in itself, just a means to an end. - King Crimson
>
> _______________________________________________
> SaoPaulo-pm mailing list
> SaoPaulo-pm at pm.org
> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>



-- 
Ricardo Bittencourt
http://www.ricbit.com


More information about the SaoPaulo-pm mailing list