regular expression search replace

From: J. VerSchave (carlisle411_at_yahoo.com)
Date: 02/29/04


Date: 28 Feb 2004 15:22:09 -0800

I am trying to do this using regular expressions in Java:

replace

http://whatever.com

with

<a href="http://whatever.com">http://whatever.com>

This URL is embedded within a String, i.e.:

String buffer = "The other I came across http://whatever.com. It is
cool.";

I want to perform some operation on this buffer and have the result
be:

"The other I came across <a
href="http://whatever.com">http://whatever.com>. It is cool."

Seems like this should be easy to do but I have been unsuccessful thus
far in finding a solution. Thanks.

-j



Relevant Pages

  • Re: Java and buffer overflows
    ... It is possible that JVM protects against the majority of buffer overflows, ... Java source below. ...
    (Vuln-Dev)
  • Re: Passing large C buffers to Java (via JNI) without copying?
    ... C-side buffer in a Java object which will access it directly. ... But remember that /every/ access to that data from Java will then cost more than a direct lookup in a bytearray would, so you should carefully consider whether that overhead will overall be greater than that of a single copy. ... Another factor to consider is that if the JVM allocates the byte buffer then it'll zero the memory for you, which will add a cost not so far off the cost of the copy -- but that might be acceptable if the C code would otherwise have to zero the memory itself. ...
    (comp.lang.java.programmer)
  • Re: fortran+java i/o (stupid) problem
    ... The Java read-thread lives concurrently, ... > data down the pipe to spawned process. ... > to the IO buffering in your Fortran program; if it is buffered, ... Some buffer the inter-process pipes, ...
    (comp.os.linux.development.apps)
  • Re: fortran+java i/o (stupid) problem
    ... The Java write-thread may live ... to the IO buffering in your Fortran program; if it is buffered, ... In general, when two processes share an IO pipe, the write end ... Some buffer the inter-process pipes, ...
    (comp.os.linux.development.apps)
  • Re: regular expression reverse match?
    ... >> determines if the buffer is acceptable against a pattern as the string ... >> added to the buffer as long as it's within the pattern. ... >I don't think its possible with regular expressions, or at least the way you ... I compared rex to simplifying a math problem like ...
    (comp.lang.python)