2 * Copyright (c) 2010-2021 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.mielecloud.internal.util;
15 import java.util.regex.Pattern;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * Utility for validating e-mail addresses.
22 * @author Björn Lange - Initial Contribution
25 public final class EmailValidator {
26 private static final Pattern EMAIL_PATTERN = Pattern.compile("^[\\w-_\\.+]*[\\w-_\\.]\\@([\\w]+\\.)+[\\w]+[\\w]$");
28 private EmailValidator() {
29 throw new UnsupportedOperationException();
32 public static boolean isValid(String emailAddress) {
33 return EMAIL_PATTERN.matcher(emailAddress).matches();