Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Added Regex tutorial to Help.html, because many people don't understand Regex. Added german translation for Regex tutorial. Added bold and underline to bbCode.

rramthun20002b6386c2
diff --git a/htroot/Help.html b/htroot/Help.html
index 2875acc61..56a6b982c 100644
--- a/htroot/Help.html
+++ b/htroot/Help.html
@@ -66,7 +66,44 @@ s --> Search Page<br>
n --> News<br>
w --> Network<br>
t --> Status<br>
-
+<br>
+<br>
+<hr>
+YaCy uses Regular Expressions for some functions, for example in the blacklist.<br>
+<br>
+There are some standards for these regexps, YaCy uses the syntax used by Perl 5.<br>
+Here ist a short overview about the functions, which should fir for most cases:<br>
+<br>
+<br>
+<table>
+<tr><td>.</td><td>: arbitrary character</td></tr>
+<tr><td>x</td><td>: character x</td></tr>
+<tr><td>^x</td><td>: not x</td></tr>
+<tr><td>x*</td><td>: 0 or more times x</td></tr>
+<tr><td>x?</td><td>: 0 or 1 time x</td></tr>
+<tr><td>x+</td><td>: 1 or more times x</td></tr>
+<tr><td>xy</td><td>: concatenation of x and y</td></tr>
+<tr><td>x|y</td><td>: x or y</td></tr>
+<tr><td>[abc]</td><td>: a or b or c (same as a|b|c)</td></tr>
+<tr><td>[a-c]</td><td>: a or b or c (same as above)</td></tr>
+<tr><td>x{n}</td><td>: exactly n appearances of x</td></tr>
+<tr><td>x{n,}</td><td>: at least n appearances of x</td></tr>
+<tr><td>x{n,m}</td><td>: at least n, maximum m appearanches of x</td></tr>
+<tr><td>( )</td><td>: Modify priority of instructions</td></tr>
+<tr><td>\</td><td>: Escape-Character, used to escape special characters (for example "[" or "*"), so that they loose their special meaning</td></tr>
+</table>
+<br>
+<br>
+Regex follow a special priority (descending): concatenation, unary operators (*,+,^,{}), binary operators (|). This can be overridden with brackets.<br>
+<br>
+Example:<br>
+<br>
+.*heise.de/.*/[0-9]+<br>
+<br>
+This matches heise.de/ with a string in front of it, for example "http://www.", followed by any string, then a slash and a number. The dot in "heise.de" is not escaped with "\", because it represents any character, thus the "." itself, too.<br>
+A possible URL which would match this regexp is: http://www.heise.de/newsticker/meldung/59421<br>
+An URL which would not match is: http://www.heise.de/tp/r4/artikel/20/20701/1.html<br>
+There is ".html" at the end, which is not included with the Regular Expression.
#[footer]#
</body>
</html>
diff --git a/locales/de.lng b/locales/de.lng
index f2f49eb8d..95195e5c2 100644
--- a/locales/de.lng
+++ b/locales/de.lng
@@ -43,7 +43,7 @@ Delete URL pattern==URL aus der Liste l
Enter new domain name / path pattern in the form:==Geben Sie eine neue Domain/einen neuen Pfad in dieser Form ein:
"&lt;domain&gt;/&lt;path-regexpr&gt;":=="&lt;Domain&gt;/&lt;Pfad&gt;"
Add URL pattern==F�ge URL hinzu
-Import blacklist items from other YaCy peers:==Importiere Blacklists von anderen YaCy Peers:
+Import blacklist items from other YaCy peers:==Importiere Blacklist von anderen YaCy Peers:
Host:==Host:
"Load new blacklist items"==Lade neue Blacklist
Import blacklist items from URL:==Importiere Blacklist von URL:
@@ -157,6 +157,30 @@ Search Page==Suchseite
Network==Netzwerk
Status==Status
+YaCy uses Regular Expressions for some functions, for example in the blacklist.==YaCy benutzt regul�re Ausdr�cke f�r einige Funktionen, z.B. die Blacklist.
+There are some standards for these regexps, YaCy uses the syntax used by Perl 5.==Es gibt einige Standards f�r diese Ausdr�cke, YaCy orientiert sich an der Syntax von Perl 5.
+Here ist a short overview about the functions, which should fir for most cases\:<==Hier finden Sie einen kurzen �berblick �ber die Funktionen, der die meisten Anwenungsf�lle abdecken sollte:<
+arbitrary character==beliebiges Zeichen
+character x==Zeichen x
+not x==nicht x
+0 or more times x==0 oder mehr Vorkommen von x
+0 or 1 time x==0 oder 1 Vorkommen von x
+1 or more times x==1 oder mehr Vorkommen von x
+concatenation of x and y==Verkettung von x und y
+x or y==x oder y
+a or b or c (same as a\|b\|c)==a oder b oder c (dasselbe wie a|b|c)
+a or b or c (same as above)==a oder b oder c (dasselbe wie oben)
+exactly n appearances of x==genau n Vorkommen von x
+at least n appearances of x==mindestens n Vorkommen von x
+at least n, maximum m appearanches of x==mindestens n, maximal m Vorkommen von m
+Modify priority of instructions==Priorit�t der Befehle �ndern
+Escape-Character, used to escape special characters \(for example "\[" or "\*"\), so that they loose their special meaning==Escape-Zeichen, das benutzt wird, um Zeichen mit Sonderbedeutung (z.B. "[" oder "*"), zu "escapen", d.h. ihre Sonderbedeutung verlieren.
+Regex follow a special priority \(descending\)\: concatenation, unary operators \(\*,\+,\^,\{\}\), binary operators \(\|\). This can be overridden with brackets.==Regex folgen Priorit�ten (absteigend): Verkettung, un�re Operatore (*,+,^,{}), bin�re Operatoren (|). Die Reihenfolge kann durch setzen von Klammern ge�ndert werden.
+Example:==Beispiel:
+This matches heise.de/ with a string in front of it, for example "http://www.", followed by any string, then a slash and a number. The dot in "heise.de" is not escaped with "\\", because it represents any character, thus the "." itself, too.==Dies erf�llt heise.de/ mit einem String davor, z.B. "http://www.". Es folgt ein beliebiger String, dann ein Slash und eine Zahl. Der Punkt in "heise.de" ist nicht escaped, weil der Punkt f�r ein beliebiges Zeichen steht, folglich auch f�r "." selbst.
+A possible URL which would match this regexp is\:==Eine URL, die den regul�ren Ausdruck erf�llen w�rde, ist:
+An URL which would not match is:==Eine URL die diese Regex nicht erf�llen w�rde ist:
+There is ".html" at the end, which is not included with the Regular Expression.==Hier ist ".html" am Ende angeh�ngt, das nicht in der Regex enthalten ist.
#-----------------------------------------------------------
#File: index.html
@@ -519,7 +543,7 @@ reversed order==in umgekehrter Reihenfolge
YaCy: Remote Peer Profile==YaCy: Remote Peer Profil
Remote Peer Profile:==Remote Peer Profil:
-Wrong access of this page==Kein Zugriff auf diese Seite
+Wrong access of this page==Falscher Zugriff auf diese Seite
The requested peer is not known or a potential peer, what means the peer's profile can't be fetched, because he is behind a firewall.==Der gew�nschte Peer ist nicht bekannt oder ein potenzieller Peer, das bedeutet, das Profil kann nicht geladen werden, da der Peer hinter einer Firewall ist.
The peer==Der Peer
is not online.==ist nicht online.
diff --git a/source/de/anomic/tools/bbCode.java b/source/de/anomic/tools/bbCode.java
index 0eb9aaa36..14b4521d8 100644
--- a/source/de/anomic/tools/bbCode.java
+++ b/source/de/anomic/tools/bbCode.java
@@ -73,15 +73,23 @@ public class bbCode {
return output;
}
- /**Parses parts of bbCode (will be extended).
+ /**Parses parts of bbCode (to-do: [Img],[URL],[List],[List=]).
*@author Alexander Schier
+ *@author Roland Ramthun
*@return String
*/
public String bb(String input){
String output = escapeHtml(input);
-
+ //Parse bold
output = output.replaceAll("\\[b\\]", "<b>");
output = output.replaceAll("\\[/b\\]", "</b>");
+ //Parse italic
+ output = output.replaceAll("\\[i\\]", "<i>");
+ output = output.replaceAll("\\[/i\\]", "</i>");
+ //Parse underlined
+ output = output.replaceAll("\\[u\\]", "<u>");
+ output = output.replaceAll("\\[/u\\]", "</u>");
+
return output;
}
}