From 664ecfbf6fee4e39efe7092e52c3d52dade0d3f8 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 23 Dec 2002 03:15:32 +0000 Subject: [PATCH 1/1] pre-compile delete forbidden tag rexexp as well as add deleteTableTags method.. get rid of some unused methods. --- source/mir/misc/StringUtil.java | 129 +++++----------------------------------- 1 file changed, 14 insertions(+), 115 deletions(-) diff --git a/source/mir/misc/StringUtil.java b/source/mir/misc/StringUtil.java index 85b1bc3f..57139c7b 100755 --- a/source/mir/misc/StringUtil.java +++ b/source/mir/misc/StringUtil.java @@ -40,13 +40,14 @@ import gnu.regexp.*; /** * Statische Hilfsmethoden zur Stringbehandlung * - * @version $Id: StringUtil.java,v 1.30 2002/12/14 01:37:43 zapata Exp $ + * @version $Id: StringUtil.java,v 1.31 2002/12/23 03:15:32 mh Exp $ * @author mir-coders group * */ public final class StringUtil { - private static RE re_newline2br, re_brbr2p, re_mail, re_url, re_tags; + private static RE re_newline2br, re_brbr2p, re_mail, re_url, re_tags, + re_tables, re_forbiddenTags; private StringUtil() { } // this avoids contruction @@ -58,6 +59,8 @@ public final class StringUtil { re_mail = new RE("([a-zA-Z0-9_.-]+)@([a-zA-Z0-9_-]+)\\.([a-zA-Z0-9_.-]+)"); re_url = new RE("((https://)|(http://)|(ftp://)){1}([a-zA-Z0-9_-]+).([a-zA-Z0-9_.:-]+)/?([^ \t\r\n<>\\)\\]]+[^ \t\r\n.,<>\\)\\]])"); re_tags = new RE("<[^>]*>",RE.REG_ICASE); + re_tables = new RE("<[ \t\r\n/]*(table|td|tr)[ \t\r\n]*>",RE.REG_ICASE); + re_forbiddenTags = new RE("<[ \t\r\n/]*(body|head|script)[ \t\r\n]*>",RE.REG_ICASE); } catch (REException e){ System.err.println("FATAL: StringUtil: could not precompile REGEX: "+e.toString()); @@ -162,17 +165,15 @@ public final class StringUtil { * this method deletes all