Commit 0b7d390b authored by sikeda's avatar sikeda
Browse files

[dev] Introducing new regexp Sympa::Regexps::addrspec to prevent unexpected grouping.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12615 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 19d6ba80
......@@ -1701,10 +1701,10 @@ sub add {
$log->syslog('debug', '(%s, %s, %s, %s)',
$what, $robot, $sign_mod, $message);
my $email_regexp = Sympa::Regexps::email();
my $email_regexp = Sympa::Regexps::addrspec();
$what =~ /^(\S+)\s+($email_regexp)(\s+(.+))?\s*$/;
my ($which, $email, $comment) = ($1, $2, $6);
$what =~ /^(\S+)\s+($email_regexp)(?:\s+(.+))?\s*$/;
my ($which, $email, $comment) = ($1, $2, $3);
## Load the list if not already done, and reject the
## subscription if this list is unknown to us.
......@@ -2440,7 +2440,7 @@ sub del {
$log->syslog('debug', '(%s, %s, %s, %s)',
$what, $robot, $sign_mod, $message);
my $email_regexp = Sympa::Regexps::email();
my $email_regexp = Sympa::Regexps::addrspec();
$what =~ /^(\S+)\s+($email_regexp)\s*/;
my ($which, $who) = ($1, $2);
......
......@@ -27,9 +27,10 @@ package Sympa::Regexps;
use strict;
use warnings;
## Regexps for list params
## Caution : if this regexp changes (more/less parenthesis), then regexp using
## it should also be changed
# This is the same as email below except that it does never give any groups.
use constant addrspec => qr{(?:[-&+'./\w=]+|".*")\@[-\w]+(?:[.][-\w]+)+};
# Caution: If this regexp changes (more/less parenthesis), then regexp using
# it should also be changed. By this reason it would be obsoleted.
use constant email => qr'([\w\-\_\.\/\+\=\'\&]+|\".*\")\@[\w\-]+(\.[\w\-]+)+';
use constant family_name => qr'[a-z0-9][a-z0-9\-\.\+_]*';
## Allow \s for template names
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment