You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by ������ ���������� <se...@zolshar.ru> on 2001/12/19 18:48:52 UTC

substitution: what stands for the whole match

Hello oro-users,

I have a problem with substituting a match by itself.
In perl i can use $& which stands for the whole match,
but it seems oro doesn't understand this:

String patt="\\d+";
String sub="$&$&";
String input="12 345";

System.out.println(
  Util.substitute(new Perl5Matcher(),
                  new Perl5Compiler().compile(patt),
                  new Perl5Substitution(sub,Perl5Substitution.INTERPOLATE_ALL),
                  input,
                  Util.SUBSTITUTE_ALL)
);

The output is "&& &&" while expected was "1212 345345".

So my questions are:
1.How can I obtain "1212 345345" from "12 345" without changing a pattern?
2.Why oro doesn't support "$&" expression while it's standard in perl?

-- 
Best regards,
 Сергей                          mailto:serge@zolshar.ru

P.S. Using 0 instead of & doesn't help too, though with non-zero
groups substitution works fine.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>