All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lucuma.core.data.EmailAddress.scala Maven / Gradle / Ivy

There is a newer version: 0.108.0
Show newest version
// Copyright (c) 2016-2023 Association of Universities for Research in Astronomy, Inc. (AURA)
// For license information see LICENSE or https://opensource.org/licenses/BSD-3-Clause

package lucuma.core.data

import eu.timepit.refined.string.MatchesRegex
import lucuma.core.util.RefinedNewType

// N.B. this is the same pattern used in the database constraint; if we change one we need to change the other.
type EmailPred =
  MatchesRegex["""^[a-zA-Z0-9_+&-]+(?:.[a-zA-Z0-9_+&-]+)*@(?:[a-zA-Z0-9-]+.)+[a-zA-Z]{2,7}$"""]

object EmailAddress extends RefinedNewType[String, EmailPred]
type EmailAddress = EmailAddress.Type

extension (self: EmailAddress) def value: EmailAddress = self





© 2015 - 2024 Weber Informatics LLC | Privacy Policy