Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
b649a139
Commit
b649a139
authored
Jul 17, 2019
by
Greg Messner
Browse files
Cleaned up code formatting.
parent
7174a517
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/utils/EmailChecker.java
View file @
b649a139
...
...
@@ -4,20 +4,24 @@ import java.util.regex.Pattern;
public
class
EmailChecker
{
/** Java regular expression for validating an email address. */
public
static
final
String
EMAIL_REGEX
=
"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"
;
/** Java regular expression for validating an email address. */
public
static
final
String
EMAIL_REGEX
=
"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\""
+
"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")"
+
"@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:"
+
"(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:"
+
"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"
;
/** Java Pattern instance for validating an email address. */
public
static
final
Pattern
EMAIL_REGEX_PATTERN
=
Pattern
.
compile
(
EMAIL_REGEX
);
/** Java Pattern instance for validating an email address. */
public
static
final
Pattern
EMAIL_REGEX_PATTERN
=
Pattern
.
compile
(
EMAIL_REGEX
);
/**
* Returns true if the provided String is a valid email address.
*
* @param email the email address to check for validity
* @return true if the provided String is a valid email address, otherwise return false
*/
public
static
final
boolean
isValidEmail
(
final
String
email
)
{
return
(
email
==
null
?
false
:
EMAIL_REGEX_PATTERN
.
matcher
(
email
).
matches
());
}
/**
* Returns true if the provided String is a valid email address.
*
* @param email the email address to check for validity
* @return true if the provided String is a valid email address, otherwise return false
*/
public
static
final
boolean
isValidEmail
(
final
String
email
)
{
return
(
email
==
null
?
false
:
EMAIL_REGEX_PATTERN
.
matcher
(
email
).
matches
());
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment