Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-21475

regular expression for email validation

    XMLWordPrintable

    Details

      Description

      http://en.wikipedia.org/wiki/E-mail_address

      the current regular expression for valid_email function (lib/weblib.php) does not validate the domain name accordingly.

      I proposed for modifying the regular expression so it matches the RFC specification.

      proposed new regular expression:

      preg_match('#^([^\.]([\!\#\$\%\&\'\*\+\-\/=\?\^\_`\{\|\}\~a-z0-9]+\.)*' .
                      '[\!\#\$\%\&\'\*\+\-\/=\?\^\_`\{\|\}\~a-z0-9]+)' .
                      '@' .
                      '(([a-z0-9\_\-]{1,64}\.)*[a-z0-9\_\-]{1,64})$#i',
                      $address);

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h