Committed by
GitHub
Merge pull request #2585 from alindeman/isurl-tld
Support TLDs of up to 7 characters
Showing
2 changed files
with
2 additions
and
1 deletions
@@ -206,7 +206,7 @@ class GetUtils { | @@ -206,7 +206,7 @@ class GetUtils { | ||
206 | 206 | ||
207 | /// Checks if string is URL. | 207 | /// Checks if string is URL. |
208 | static bool isURL(String s) => hasMatch(s, | 208 | static bool isURL(String s) => hasMatch(s, |
209 | - r"^((((H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\://)?(www.|[a-zA-Z0-9].)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,6}(\:[0-9]{1,5})*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$"); | 209 | + r"^((((H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\://)?(www.|[a-zA-Z0-9].)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,7}(\:[0-9]{1,5})*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$"); |
210 | 210 | ||
211 | /// Checks if string is email. | 211 | /// Checks if string is email. |
212 | static bool isEmail(String s) => hasMatch(s, | 212 | static bool isEmail(String s) => hasMatch(s, |
@@ -213,6 +213,7 @@ void main() { | @@ -213,6 +213,7 @@ void main() { | ||
213 | 'http://appliance.example.com/bee/badge', | 213 | 'http://appliance.example.com/bee/badge', |
214 | 'http://www.example.org/berry.aspx', | 214 | 'http://www.example.org/berry.aspx', |
215 | 'http://example.org/', | 215 | 'http://example.org/', |
216 | + 'http://birds.example/', | ||
216 | ]; | 217 | ]; |
217 | 218 | ||
218 | for (final url in urls) { | 219 | for (final url in urls) { |
-
Please register or login to post a comment