commonMain.com.tweener.kmpkit.validator.EmailAddressValidator.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kmpkit Show documentation
Show all versions of kmpkit Show documentation
A Kotlin Multiplatform utility library offering extensions, validators, providers, coroutine tools, and more to enhance KMP development.
package com.tweener.kmpkit.validator
/**
* @author Vivien Mahe
* @since 13/07/2024
*/
class EmailAddressValidator {
companion object {
private const val PATTERN =
"[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" +
"\\@" +
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" +
"(" +
"\\." +
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" +
")+"
}
fun isValid(email: String): Boolean = email.matches(Regex(PATTERN))
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy