You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-user@jakarta.apache.org by Andre Costa <co...@ntime.com.br> on 2003/06/03 01:48:28 UTC
Backreferences on substitution?
Hi all,
it seems the archives are unreachable, so I will fire this question
without having first searched for an existing answer... please bear with
newbie ignorance ;)
Is it possible to specify backreferences on substitution patterns? The
probl is: I would like to get rid of some tags but leave their content
untouched. This pattern correctly catches data on the form
<tag ...>data</tag>:
<([:alpha:]+)[^>]*>([^<]*)</\1>
However, if I want to use it on a text where it appears multiple times
with RE.subst(), how do I pass a backreference to the second capture to
the 'substitution' parameter? For example, this text
<tag1>this text</tag1> should <tag2>remain untouched</tag2>
should become
this text should remain untouched
Any clues? What am I missing?
TIA
Andre
--
Andre Oliveira da Costa
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-user-help@jakarta.apache.org