Permalink
Browse files

WICKET-4477 SmartLinkLabel escape minus in pattern

  • Loading branch information...
1 parent bbfaa56 commit d9c48eb7a66fe9d180b7d34324326fcee75b84ba Sven Meier committed Mar 27, 2012
@@ -29,7 +29,7 @@
public class DefaultLinkParser extends LinkParser
{
/** Email address pattern */
- private static final String emailPattern = "[\\w\\.-\\\\+]+@[\\w\\.-]+";
+ private static final String emailPattern = "[\\w\\.\\-\\\\+]+@[\\w\\.\\-]+";
/** URL pattern */
private static final String urlPattern = "([a-zA-Z]+://[\\w\\.\\-\\:\\/~]+)[\\w\\.:\\-/?&=%]*";
@@ -76,7 +76,7 @@ public void dontParseMarkup()
}
/**
- * testEmailWithPlusChar()
+ * WICKET-3174
*/
@Test
public void testEmailWithPlusChar()
@@ -89,4 +89,19 @@ public void testEmailWithPlusChar()
assertEquals("Expected chars to left of + to be included in the link.", testExpectedLink,
result);
}
+
+ /**
+ * WICKET-4477
+ */
+ @Test
+ public void testEmailWithMinusChar()
+ {
+ final String testEmailAddress = "my-test@example.com";
+ final String testExpectedLink = "<a href=\"mailto:my-test@example.com\">my-test@example.com</a>";
+
+ ILinkParser parser = new DefaultLinkParser();
+ final String result = parser.parse(testEmailAddress);
+ assertEquals("Expected chars to left of - to be included in the link.", testExpectedLink,
+ result);
+ }
}

0 comments on commit d9c48eb

Please sign in to comment.