Skip to content

Commit

Permalink
fix for GRAILS-6249
Browse files Browse the repository at this point in the history
updated regex doesn't show O(n^2) behavior with long domain names
see also http://svn.apache.org/viewvc?view=revision&revision=600231
  • Loading branch information
Andrew Taylor committed Mar 3, 2011
1 parent 72408c7 commit 83bf11a
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -63,7 +63,7 @@ public class DomainValidator implements Serializable {

private static final long serialVersionUID = -7709130257134339371L;
// Regular expression strings for hostnames (derived from RFC2396 and RFC 1123)
private static final String DOMAIN_LABEL_REGEX = "\\p{Alnum}(?:[\\p{Alnum}-]*\\p{Alnum})*";
private static final String DOMAIN_LABEL_REGEX = "\\p{Alnum}(?>[\\p{Alnum}-]*\\p{Alnum})*";
private static final String TOP_LABEL_REGEX = "\\p{Alpha}{2,}";
private static final String DOMAIN_NAME_REGEX =
"^(?:" + DOMAIN_LABEL_REGEX + "\\.)+" + "(" + TOP_LABEL_REGEX + ")$";
Expand Down

0 comments on commit 83bf11a

Please sign in to comment.