Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for subdomains containing underscores

  • Loading branch information...
commit 65900bc2d73473af6234bb5c0c8394771f408675 1 parent 7ef05cf
J.P. Cummins authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 twitter-text.js
View
5 twitter-text.js
@@ -100,7 +100,10 @@ if (!window.twttr) {
// URL related hash regex collection
twttr.txt.regexen.validPrecedingChars = regexSupplant(/(?:[^-\/"':!=A-Za-z0-9_@@]|^|\:)/);
- twttr.txt.regexen.validDomain = regexSupplant(/(?:[^#{punct}\s][\.-](?=[^#{punct}\s])|[^#{punct}\s]){1,}\.[a-z]{2,}(?::[0-9]+)?/i);
+
+ twttr.txt.regexen.validSubdomain = regexSupplant(/([^#{punct}\s]([_-]|[^#{punct}\s])*)?[^#{punct}\s]\./);
+ twttr.txt.regexen.validDomainName = regexSupplant(/([^#{punct}\s]([-]|[^#{punct}\s])*)?[^#{punct}\s]/);
+ twttr.txt.regexen.validDomain = regexSupplant(/(#{validSubdomain})*#{validDomainName}\.[a-z]{2,}(?::[0-9]+)?/i);
twttr.txt.regexen.validGeneralUrlPathChars = /[a-z0-9!\*';:=\+\$\/%#\[\]\-_,~]/i;
// Allow URL paths to contain balanced parens
Please sign in to comment.
Something went wrong with that request. Please try again.