fix small email address filtering bug (originally the fix was from Max in the HEAD...
[mir.git] / source / mir / misc / StringUtil.java
index 93d4c6b..4315a45 100755 (executable)
@@ -40,18 +40,11 @@ import  gnu.regexp.*;
 /**
  * Statische Hilfsmethoden zur Stringbehandlung
  *
- * @version $Revision: 1.23.2.1 $ $Date: 2002/09/01 21:31:40 $
- * @author $Author: mh $
- *
- * $Log: StringUtil.java,v $
- * Revision 1.23.2.1  2002/09/01 21:31:40  mh
- * Mir goes GPL
- *
- * Revision 1.23  2002/06/28 20:39:37  mh
- * added numberformat helper. make webdbDate2readableDate use webdb_create instead. make the order and appearance of it more consistent. cvs macros. and finally code tidying
- *
+ * @version $Id: StringUtil.java,v 1.23.2.3 2002/12/09 06:23:38 mh Exp $
+ * @author rk, mir-coders group
  *
  */
+
 public final class StringUtil {
 
        private static RE   re_newline2br, re_brbr2p, re_mail, re_url, re_tags;
@@ -63,7 +56,7 @@ public final class StringUtil {
                        //precompile regex
                        re_newline2br = new RE("(\r?\n){1}");
                        re_brbr2p     = new RE("(<br>\r?\n<br>){1,}");
-                       re_mail       = new RE("([a-zA-Z0-9_.-]+)@([a-zA-Z0-9_-]+).([a-zA-Z0-9_.-]+)");
+      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);
                }
@@ -597,39 +590,6 @@ public final class StringUtil {
                return buf.toString();
        }
 
-
-       public static String decodeHTMLinTags(String s){
-               StringBuffer buffer = new StringBuffer();
-               boolean start = false;
-               boolean stop = false;
-               int startIndex = 0;
-               int stopIndex = 0;
-               int temp = 0;
-
-               for(int i=0;i<s.length();i++){
-                       if(s.charAt(i)=='<'){
-                               start = true;
-                               startIndex = i;
-                       } else if(s.charAt(i)=='>'){
-                               stop = true;
-                               stopIndex = i;
-
-                               if(start && stop){
-                                       buffer.append(s.substring(temp,startIndex));
-                                       buffer.append(replaceQuot(s.substring(startIndex,stopIndex+1)));
-                                       i= temp= stopIndex+1;
-                                       start= stop= false;
-                               }
-                       }
-               }
-               if(stopIndex>0){
-                       buffer.append(s.substring(stopIndex+1));
-                       return buffer.toString();
-               } else {
-                       return s;
-               }
-       }
-
        public static String replaceQuot(String s) {
                StringBuffer buffer = new StringBuffer();
                for(int j = 0; j < s.length();j++){
@@ -645,50 +605,6 @@ public final class StringUtil {
                return buffer.toString();
        }
 
-       /** wandelt Quotes in Sonderzeichen um
-        */
-       /**
-       public static String decodeHtml(String s) {
-               StringBuffer buf = new StringBuffer();
-               for(int i=0;i < s.length(); i++ ) {
-                       if( s.indexOf( "&ouml;", i ) == i ) {
-                               buf.append( "ö" ); i += 5;
-                               continue;
-                       }
-                       if( s.indexOf( "&auml;", i ) == i ) {
-                               buf.append( "ä" ); i += 5;
-                               continue;
-                       }
-                       if( s.indexOf( "&uuml;", i ) == i ) {
-                               buf.append( "ü" ); i += 5;
-                               continue;
-                       }
-                       if( s.indexOf( "&Ouml;", i ) == i ) {
-                               buf.append( "Ö" ); i += 5;
-                               continue;
-                       }
-                       if( s.indexOf( "&Auml;", i ) == i ) {
-                               buf.append( "Ä" ); i += 5;
-                               continue;
-                       }
-                       if( s.indexOf( "&Uuml;", i ) == i ) {
-                               buf.append( "Ü" ); i += 5;
-                               continue;
-                       }
-                       if( s.indexOf( "&szlig;", i ) == i ) {
-                               buf.append( "ß" ); i += 6;
-                               continue;
-                       }
-                       if( s.indexOf( "&quot;", i ) == i ) {
-                               buf.append( "\"" ); i += 5;
-                               continue;
-                       }
-                       buf.append( s.charAt(i) );
-               }
-               return buf.toString();
-       }
-        */
-
        /**
         * schnellere Variante der String.toLowerCase()-Routine
         *