I am working on an important production issue and am almost ready to
start pulling hair out.

I need to scrub emails from outgoing html and am using regexp for this.
I am stuck with regexp library for jdk 1.3 platform.

It works fine with JDK 1.5 impl and gnu-regexp...however gnu-regexp
fails when used in my appserver...so I'm trying jakarta impl. Problem is
that substitution seems broken and it's substituting OVER text that
needs to be preserved.

I will be working overnight to fix this issue and help is MUCH
appreciated...thanks.

You can see from below I am using same regexp (of course) across all 3
implementations.


mike klein


|        String newString =
theString.replaceAll("[EMAIL PROTECTED],4}",
"[EMAIL PROTECTED]");
        System.out.println("Using JDK 1.5....new string =
\n============\n"+newString+"============\n");

        RE re = new RE("[EMAIL PROTECTED],4}");
        String newString2 = re.subst(theString, "[EMAIL PROTECTED]");
        System.out.println("Using jakarta....new string =
\n============\n"+newString2+"============\n");

        try
        {
            gnu.regexp.RE re2 = new
gnu.regexp.RE("[EMAIL PROTECTED],4}");
            String newString3 = re2.substituteAll(theString, "[EMAIL 
PROTECTED]");
            System.out.println("Using gnuregexp....new string =
\n============\n"+newString3+"============\n");
        }
        catch(Exception x)
        {
            System.out.println(x);
            System.exit(0);
        }



C:\projects\regexp>java -cp
jakarta-regexp-1.4.jar;gnu-regexp-1.1.4.jar;. regexp
Read in file:
=============
[EMAIL PROTECTED]
[EMAIL PROTECTED]
foo
[EMAIL PROTECTED]
 [EMAIL PROTECTED] [EMAIL PROTECTED]       [EMAIL PROTECTED]
<a>[EMAIL PROTECTED]</a>

=============

Using JDK 1.5....new string =
============
[EMAIL PROTECTED]
[EMAIL PROTECTED]
foo
[EMAIL PROTECTED]
 [EMAIL PROTECTED] [EMAIL PROTECTED]       [EMAIL PROTECTED]
<a>[EMAIL PROTECTED]</a>
============

Using jakarta....new string =
============
[EMAIL PROTECTED]
[EMAIL PROTECTED]
foo
[EMAIL PROTECTED]
 [EMAIL PROTECTED] [EMAIL PROTECTED]       [EMAIL PROTECTED]
[EMAIL PROTECTED]</a>
============

Using gnuregexp....new string =
============
[EMAIL PROTECTED]
[EMAIL PROTECTED]
foo
[EMAIL PROTECTED]
 [EMAIL PROTECTED] [EMAIL PROTECTED]       [EMAIL PROTECTED]
<a>[EMAIL PROTECTED]</a>
============

|

Reply via email to