Jump to content

break the Email as a username..


meto5757

Recommended Posts

Hello, I tried to change the login system for my DB to be both username and E-mail.

 

now I have the data like :

 

Mat:mat34@example.com

 

Now I would like to make a reg Ex to extract only mat34.

 

I know that explaod in php can do it , but what about RegEx ?

 

Thanks

Link to comment
Share on other sites

If you always add a semi-colon to the username, and you don't allow it to be used in usernames, you don't need regular expressions for this.

Just a simple substr () and strpos () combination.

 

That said: Why would you store the username and e-mail combined? This goes against good database design, and as such you're only creating more work for yourself. As evidenced by this thread. I recommend storing them in two different fields, as you were. If you want to use the e-mail in addition to the username as a possible identificator when your users log in, then add an "OR" in your query.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.