Yes, I tried this pattern originally. Trying it again still yields an unchanged string. I have no clue where the bug is...

On Jan 17, 2006, at 3:40 PM, Mike Cherba wrote:

From what I can tell, the correct option should be:
"\\&lt\\;". Since the regex you want is "\&lt\;" and Java needs the
backslashes escaped in string literals.
                -Mike


On Tue, 2006-01-17 at 15:14 -0800, Jim Beard wrote:
You are basically correct Mike.

<--- Sample Code -->
     // set up the xml string
     File asynchFile = new File("../some.xml");
     FileReader asynchFileReader = new FileReader(asynchFile);
     BufferedReader bufferedASynchReader = new BufferedReader
(asynchFileReader);
     String line = bufferedASynchReader.readLine();
     for (;line != null; line = bufferedASynchReader.readLine()) {
       if (m_asynchro == null)
         m_asynchro = "";
       m_asynchro += line;
     }
     if (m_asynchro != null) {
       m_asynchro = m_asynchro.replaceAll("\\c&lt\\c;", "<");
       m_asynchro = m_asynchro.replaceAll("&gt;", ">");
       System.out.println(m_asynchro);
     }
<-- End Code -->

I just tried "\&lt;" for the pattern that Russ kindly suggested, but
still no luck.  I've tried "\\&lt\\;" before as well...  Rather
frustrating really.

On Jan 17, 2006, at 2:52 PM, Mike Cherba wrote:

Jim,
        I just want to make sure I understand exactly what you are doing.
You
have an input string which contains some number of instances of the
substring "&lt;".  you would like to make a duplicate copy of the
string
where the instances of "&lt;" have been replaced by instances of
"<"  I
assume you would like to do the same with "&gt;" as well.  You are
doing
the string manipulation in Java. Can you post the code you have tried so far so we can see the context? I'm sure someone on here will have
some ideas.
                        -Mike

Pointers are like jumps, leading wildly from one part of the data
structure to another. Their introduction into high-level languages has
been a step backwards from which we may never recover. --- Charles
Hoare

On Tue, 2006-01-17 at 14:37 -0800, Jim Beard wrote:
Ok,

I know this isn't exactly the list for it, but I've been reading
online for a while now and can't make heads or tails of my problem.
I want to match convert '&lt;' sequences to '<' using a replace
method that matches on a regex pattern. I'm using Java and am having 0 luck. No sites online seem to mention & or ; other then in passing
as a punctuation character...

Shouldn't this be easy?
_______________________________________________
EUGLUG mailing list
euglug@euglug.org
http://www.euglug.org/mailman/listinfo/euglug

_______________________________________________
EUGLUG mailing list
euglug@euglug.org
http://www.euglug.org/mailman/listinfo/euglug

_______________________________________________
EUGLUG mailing list
euglug@euglug.org
http://www.euglug.org/mailman/listinfo/euglug
--
Mike Cherba
Cavium Networks
883 Brookside Dr
Eugene, OR 97405
phone: (541) 684-3820
Cell:  (541) 914-2188
[EMAIL PROTECTED]
www.caviumnetworks.com
_______________________________________________
EUGLUG mailing list
euglug@euglug.org
http://www.euglug.org/mailman/listinfo/euglug

_______________________________________________
EUGLUG mailing list
euglug@euglug.org
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to