Created
February 12, 2019 16:46
-
-
Save buddypia/e7aaab0a219bc17edd2bc2d6326f2120 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Utils { | |
static bool isNullOrEmpty(String s) { | |
return s == null || s == ''; | |
} | |
static String stripTags(String s) { | |
return s.replaceAll(new RegExp('<[^>]*>'), ''); | |
} | |
static Set<String> urlMatchs(String s) { | |
RegExp exp = new RegExp( | |
r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)"); | |
return exp.allMatches(s).map((m) => m.group(0)).toSet(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment