[SP-pm] [offtopic] Regex e subpatterns no SED

caio ariede caio.ariede at gmail.com
Tue Aug 19 05:54:20 PDT 2008


Bom dia.

Eu já RTFM antes de perguntar, e sei que \1 e \9 são referências ao que foi
capturado (back references), o que é diferente de subpatterns.

Um exemplo da diferença, seria:

([0-9]+):\1 casa: 11 22 33 44 55 66 77 88 99
([0-9]+):(?1) casaria: 12 13 14... 21 22.. 31 32..

E o que eu realmente preciso são subpatterns.

Me corrija se estiver errado.

abraços

2008/8/18 Alexei Znamensky <russoz em gmail.com>

> o gnu sed sim:
>
>        s/regexp/replacement/
>               Attempt  to match regexp against the pattern space.  If
> success‐
>               ful,  replace  that  portion  matched  with  replacement.
> The
>               replacement may contain the special character & to refer to
> that
>               portion of the pattern space  which  matched,  and  the
> special
>               escapes  \1  through  \9  to refer to the corresponding
> matching
>               sub-expressions in the regexp.
>
> as usual, RTFM
>
>
>
> On Mon, Aug 18, 2008 at 5:20 PM, caio ariede <caio.ariede em gmail.com>wrote:
>
>> Alguém pode me informar se o SED suporta subpatterns? Algo do tipo:
>>
>> ([0-9]+):(?1)
>>
>> Eu sei que essa lista não é sobre isso, mas já procurei em todo lugar e
>> não achei sobre isso no SED.
>>
>> Se alguém puder ajudar, valeu. ;)
>>
>> --
>> Caio Ariede
>> http://caioariede.com/
>>
>> _______________________________________________
>> SaoPaulo-pm mailing list
>> SaoPaulo-pm em pm.org
>> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>>
>
>
>
> --
> Alexei Znamensky [russoz_gmail_com] [russoz.wordpress.com] [
> www.flickr.com/photos/alexeiz]
> "Though we live in trying times, we're the ones who have to try"
>
> _______________________________________________
> SaoPaulo-pm mailing list
> SaoPaulo-pm em pm.org
> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>



-- 
Caio Ariede
http://caioariede.com/
-------------- Pr�xima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20080819/7e0458b8/attachment.html>


More information about the SaoPaulo-pm mailing list