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

  • SEARCH
  • Home
  • 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 680193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:20:41+00:00 2026-05-14T01:20:41+00:00

I really don’t understand regular expressions and was wondering what the following regular expressions

  • 0

I really don’t understand regular expressions and was wondering what the following regular expressions do. I want my address and name to accept ., - and alphanumerics.

Will this work or is there need for improvement? Plus if someone can break down the regular expressions '/^[A-Z0-9 \'.-]{1,255}$/i' so I can understand every part better.

Here is the php code.

if (preg_match ('/^[A-Z0-9 \'.-]{1,255}$/i', $_POST['address'])) {
    $address = mysqli_real_escape_string($mysqli, htmlentities($_POST['address']));
} else {
    echo '<p class="error">Please enter your address!</p>';
}

if (preg_match ('/^[A-Z0-9 \'.-]{1,255}$/i', $_POST['name'])) {
    $name = mysqli_real_escape_string($mysqli, htmlentities($_POST['name']));
} else {
    echo '<p class="error">Please enter your name!</p>';
}
  • 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-05-14T01:20:41+00:00Added an answer on May 14, 2026 at 1:20 am

    Your pattern basically allowes any combination (between 1 and 255 characters) of the following: A-Z, 0-9, space, \, ‘, .

    Decide for yourself if this is good enough.

    As for your pattern:

    /^[A-Z0-9 \'.-]{1,255}$/i 
    

    The i at the end means it isnt case sensitive

    /^[A-Z0-9 \'.-]{1,255}$/ 
    

    The slashes denote the beginning and the end of the pattern

    ^[A-Z0-9 \'.-]{1,255}$
    

    The ^ is the beginning and $ is the end of the string you look for

    [A-Z0-9 \'.-]{1,255}
    

    This allowes and combination of the characters between the brackets with 1 to 255 repetitions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really don't understand this. I have a simple ASP with 3 div in
I really don't get why this is not working. I want to avoid a
I really don't understand why this function doesn't work: function GetNomRepertoireTemporaire:WideString; var PathLocal :
I really don't understand Javascript. In PHP, I can remove quotes like this: $tags_array
I really don't understand how all this flags working since I do exactly what
I really don't understand this. I downloaded the recent version of xCode 3.2.5 and
I really don't understand the striping behaviour resulting from the following code. I had
I really don't understand why this is being so hard for me to get
I really don't want to have to reinvent the wheel with this one. There
I really don't understand what I'm doing wrong, but according to Adobe, this is

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.