> is there a way to do regex backreference replacement with the String class
> without Pattern and Matcher? for example, I'd like to do something like
[quoted text clipped - 13 lines]
>
> Marc
public class MarcE{
public static void main(String[] args){
String somebigstring =
"blahblahblah<hooey>and some stuff here</hooey> and some other
stuff";
String mystring = somebigstring.substring
(somebigstring.indexOf("<hooey>") +"<hooey>".length(),
somebigstring.indexOf("</hooey>"));
String mystring2 = somebigstring.replaceAll
("^(.*?)<hooey>(.*?)</hooey>(.*?)$", "$2");
System.out.println(mystring);
System.out.println(mystring2);
}
}
Marc E - 28 Apr 2007 03:37 GMT
ahhhh, the dollar signs. i was using backslashes like you do with matcher.
thanks a million SadRed.
>> is there a way to do regex backreference replacement with the String
>> class
[quoted text clipped - 36 lines]
> }
> }