Registering/adding users with an apostrophe in their email address (o'neil@domain.co.uk)

Permalink
Hi is there a way that email addresses with an apostrophe in them can be allowed for adding or registering users? At the moment am getting an error message ... Invalid email address provided.

 
haysgeoff2 replied on at Permalink Reply
Did you sort this out? I am having the same issue.
JoWebb replied on at Permalink Reply
Did you have any success with this? Thanks
JoWebb replied on at Permalink Reply
Did you have any success with this? Thanks
xigo replied on at Permalink Reply
No, no success with this, can anyone assist?
mnakalay replied on at Permalink Reply
mnakalay
Hello,
C5 checks emails for validity using a list of allowed characters. the apostrophe is not one of them. My guess is that although apostrophes are technically allowed in emails, their support is limited with some email providers rejecting them.

If you really want to allow the use of emails than you need to create a modified version of the file ROOT/concrete/core/helpers/validation/string.php

Modify the regex in the function email allow apostrophes.
elyset replied on at Permalink Reply
How come this has not been solved yet? This post is from 2014 and I am a new user, facing this use now in 2018.
mnakalay replied on at Permalink Reply
mnakalay
You must be using an old legacy version. This problem was solved a long time ago.

If you are still on a 5.6.x version you can solve the problem like this:
Find the file concrete\core\helpers\text.php

At line 128 you will find the function email() which looks like this
public function email($email)
    {
        $regex = "/[^a-zA-Z0-9_\.!#\$\&'\*\+-?^`{|}~@]/i";
        return preg_replace($regex, '', $email);
    }

modify the $regex to be like this
$regex = '/[^a-zA-Z0-9_\.!#\$\&\'\*\+-?^`{|}~@]/i';

and it will work