Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8651039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:57:54+00:00 2026-06-12T13:57:54+00:00

Possible Duplicate: regular expression for letters, numbers and – _ I am creating a

  • 0

Possible Duplicate:
regular expression for letters, numbers and – _

I am creating a signup form in PHP and need to ensure that user’s usernames don’t contain unwanted characters. Is there anyway I can create a function that returns true for A-Z a-z 0-9 - . _.

Also I do not want the user’s emails to be from yahoo as for some reason they reject the confirmation emails sent. Along with __FILTER_VALIDATE_EMAIL__what would I need to add?

PS: is there anything wrong with the characters I have mentioned above? I have noted that gmail doesn’t allow -_ only . and YouTube only alpha-numeric characters.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:57:55+00:00Added an answer on June 12, 2026 at 1:57 pm

    Edited to use \w instead of a-zA-Z0-9_

    if(preg_match("/[^\w-.]/", $user)){
        // invalid character
    }
    if(!filter_var($email, FILTER_VALIDATE_EMAIL) || strstr($email,'@yahoo.com')) {
        // either invalid email, or it contains in @yahoo.com
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: regular expression for letters, numbers and - _ I would like to
Possible Duplicate: Regular expression: match all words except I need your help for using
Possible Duplicate: Regular Expression Sanitize (PHP) I want to make my links SEO. Before
Possible Duplicate: Regular expression to match hostname or IP Address? I need to validate
Possible Duplicate: php regular expression help? hi, i want to replace i like apple
Possible Duplicate: Using regular expression within a stored procedure I need to validate a
Possible Duplicate: Regular expression that matches valid IPv6 addresses Can any one know the
Possible Duplicate: Need a Regular expression to extract 5th to 8th charactors in a
Possible Duplicate: Getting DIV content with Regular Expression Let me first tell you that
Possible Duplicate: How exactly do Regular Expression word boundaries work in PHP? How can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.