How should we validate Kotlin multiplatform mobile(KMM)? I found this question but it used java.util.regex.Pattern and it is not useful for KMM:
            Asked
            
        
        
            Active
            
        
            Viewed 651 times
        
    1 Answers
2
            You can use the Kotlin Regex class to validate an email address
 /**
 * Email address pattern, same as [android.util.Patterns.EMAIL_ADDRESS]
 */
private val emailAddressRegex = Regex(
    "[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}" +
            ")+"
)
if (email.matches(emailAddressRegex)){
   //Valid email address
}
 
    
    
        AliSh
        
- 10,085
- 5
- 44
- 76