以下は、最小10文字から最大30文字の長さの電子メールIDの正規表現です。
scala> val email4 = """[([\w\.!#$%&*+/=?^_`{|}~-]+)@([\w]+)([\.]{1}[\w]+)+]{10,30}""".r
email4: scala.util.matching.Regex = [([\w\.!#$%&*+/=?^_`{|}~-]+)@([\w]+)([\.]{1}[\w]+)+]{10,30}
scala> email4.pattern.matcher("ar@g.com").matches
res19: Boolean = false
scala> email4.pattern.matcher("ar@gmail.com").matches
res20: Boolean = true
scala> email4.pattern.matcher("ar1234567890@gmail1234567890.com").matches
res21: Boolean = false
scala> email4.pattern.matcher("ar1234567890@gmail123456780.com").matches
res22: Boolean = false
scala> email4.pattern.matcher("ar1234567890@gma.com").matches
res23: Boolean = true
scala> email4.pattern.matcher("ar1234567890@gmghfjdfcga.com").matches
res24: Boolean = true
scala> email4.pattern.matcher("ar1234567890@gmghfjdfcga1.com").matches
res25: Boolean = true
scala> email4.pattern.matcher("ar1234567890@gmghfjdfcga111.com").matches
res26: Boolean = false
scala> email4.pattern.matcher("ar1234567890@gmghfjdfcga11.com").matches
res27: Boolean = true