Hacker News new | ask | show | jobs
by WirelessGigabit 1098 days ago
We have the following validation:

    let form_email: Option::<String> = /* ... */;
    
    match form_email {
        Some(email) if !email.is_empty() => {
            // ... send email with validation link
        },
        _ => {
            // report missing email
        }
    }

If you (can) click the validation link it's a valid email. If not... it's invalid. Saves me the trouble of debugging all the regexes.