Jakarta Regexp 1.4 apparently doesn't like the (?:...) noncapturing

group syntax...I really ought to rewrite this using JDK1.4+ regexps,
but for now we kludge it
This commit is contained in:
Eric J. Bowersox 2006-02-09 04:19:56 +00:00
parent 75f8e8f44f
commit 74787e4902
4 changed files with 14 additions and 14 deletions

View File

@ -85,7 +85,7 @@ public class EmailRewriter implements Rewriter
try try
{ // compile our regular expression { // compile our regular expression
RECompiler compiler = new RECompiler(); RECompiler compiler = new RECompiler();
s_match = compiler.compile("^[A-Za-z0-9!#$%*+-/=?^_`{|}~.]+@[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+$"); s_match = compiler.compile("^[A-Za-z0-9!#$%*+\\-/=?^_`{|}~\\.]+@[A-Za-z0-9_\\-]+(\\.[A-Za-z0-9_\\-]+)+$");
} // end try } // end try
catch (RESyntaxException e) catch (RESyntaxException e)

View File

@ -94,7 +94,7 @@ public class EmoticonTagHandler implements Rewriter
RE r = null; RE r = null;
try try
{ // compile regular expression { // compile regular expression
r = new RE("ei:\\s*(\\w+)(?:\\s*/)?\\s*"); r = new RE("ei:\\s*(\\w+)(\\s*/)?\\s*");
} // end try } // end try
catch (RESyntaxException e) catch (RESyntaxException e)

View File

@ -76,17 +76,17 @@ public class URLRewriter implements Rewriter
private static final RECompiler COMPILER = new RECompiler(); private static final RECompiler COMPILER = new RECompiler();
private static final String[] SETUP_DATA = private static final String[] SETUP_DATA =
{ {
"^http://[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+", "", "^http://[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)+", "",
"^ftp://[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+", "", "^ftp://[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)+", "",
"^gopher://[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+", "", "^gopher://[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)+", "",
"^mailto:[A-Za-z0-9!#$%*+-/=?^_`{|}~.]+@[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+$", "", "^mailto:[A-Za-z0-9!#$%*+-/=?^_`{|}~.]+@[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)+$", "",
"^news:[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+$", "", "^news:[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)+$", "",
"^nntp://[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+", "", "^nntp://[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)+", "",
"^telnet://[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+", "", "^telnet://[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)+", "",
"^tn3270://[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)+", "", "^tn3270://[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)+", "",
"^www\\.[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*", "http://", "^www\\.[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*", "http://",
"^ftp\\.[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*", "ftp://", "^ftp\\.[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*", "ftp://",
"^gopher\\.[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*", "gopher://" "^gopher\\.[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*", "gopher://"
}; };
private static final List KNOWN_ELEMENTS; private static final List KNOWN_ELEMENTS;

View File

@ -152,7 +152,7 @@ public class EmoticonManager
RE r = null; RE r = null;
try try
{ // create the regexp { // create the regexp
r = new RE("<ei:\\s*(\\w+)(?:\\s*/)?\\s*>"); r = new RE("<ei:\\s*(\\w+)(\\s*/)?\\s*>");
} // end try } // end try
catch (RESyntaxException e) catch (RESyntaxException e)