The Artima Developer Community
Sponsored Link

Java Answers Forum
appendreplace

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
glkrr

Posts: 4
Nickname: glkrr
Registered: Oct, 2002

appendreplace Posted: Apr 7, 2003 1:02 AM
Reply to this message Reply
Advertisement
hi everybody..

How to appendReplace multiple values in java.util.regex.I did single value in java.util.regex. plz send one example for multiple value purpose
THis is single appendReplace value code








import java.util.regex.*;

public class ReplaceAll {


public static void main(String args[]){

Pattern p = Pattern.compile("<a href");
StringBuffer buf = new StringBuffer("this is to test hyperlink <a href=http://www.k7mail.com>k7mail.com</a> just see the output and lets see what happens here it is <a href=http://www.k2mail.com> k2mail.com </a>");
Matcher m = p.matcher(buf.toString());
StringBuffer sb = new StringBuffer();
while(m.find()){

m.appendReplacement(sb,"<a target=_blank href");
}
m.appendTail(sb);
System.out.println("The output is "+sb.toString());



}

}

Topic: JVMs with "in-memory data" protection Previous Topic   Next Topic Topic: Trouble with using recursive function on vector

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use