If you want to do substitutions with interpolations, you should use the
POSIX-style substitutions that ORO supports.

...
if (matcher.contains(text, pattern)) {
      result = matcher.getMatch();
      temp = result.toString();
      question = temp.substring(result.begin(1), result.end(1));
}
...

That will get you the matched string. When you use perenthesis in your
regex, you will have a list of matches for each call. It's all in the doc.
The Perl 5 idioms are inherently not very portable so you shouldn't rely on
them.

----- Original Message -----
From: "Tony Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 15, 2001 1:42 PM
Subject: Titlecase


> I am attempting to titlecase a match on the word "the" and it doesn't seem
> to be working.  Here is my code:
>
>     Perl5Util perl = new Perl5Util();
>     System.out.println( perl.substitute("s/the/\\u$&/g", input ) );
>
> It simply replaces any occurrence of "the" with "\u$&".  Can anyone
provide
> any information?
>

Reply via email to