Last active
August 8, 2020 16:47
-
-
Save Skyyo/4d151de091d319018b57a139109f9673 to your computer and use it in GitHub Desktop.
#extensions
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
package com.skyyo.ext | |
inline val CharSequence?.isEmail: Boolean get() = isMatch(REGEX_EMAIL) | |
fun CharSequence?.isMatch(regex: String): Boolean = | |
!this.isNullOrEmpty() && Regex(regex).matches(this) | |
const val REGEX_EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment