bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 1517. Find Users With Valid E-Mails

1517. Find Users With Valid E-Mails

Leetcode Solutions

Using Regular Expressions to Validate Emails

  1. Start the RegEx pattern with ^ to indicate the beginning of the string.
  2. Use [a-zA-Z] to match the first character as a letter (either upper or lower case).
  3. Follow with [a-zA-Z0-9_.-]* to match any subsequent characters that can be letters, digits, underscores, periods, or dashes, repeated zero or more times.
  4. Escape the @ symbol with \@ as it is a special character in RegEx.
  5. Specify the domain with leetcode\.com (escaping the period).
  6. End the RegEx pattern with $ to indicate the end of the string.
  7. Use the REGEXP operator in the SQL query to filter the emails based on the pattern.
erDiagram
    Users {
        int user_id
        varchar name
        varchar mail
    }

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...