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

regular expression for email validation

XMLWordPrintable

      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);

            Lentz Arjen Lentz
            rwijaya Rossiani Wijaya
            Tim Hunt Tim Hunt
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

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

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.