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 8459549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:21:42+00:00 2026-06-10T13:21:42+00:00

I know a little about preg_match , however there are some that look rather

  • 0

I know a little about preg_match, however there are some that look rather complex and some that contain symbols that I don’t entirely understand. For example:

On the first one – I can only assume this has something to do with an e-mail address and url, but what do things like [^/] and the ? mean?

preg_match('@^(?:http://)?([^/]+)@i', $variable);

…..

In the second one – what do things like the ^, {5} and $ mean?

preg_match("/^[A-Z]{5}[0-9]{4}[A-Z]{1}$/", $variable);

It’s just these small things I’m not entirely sure on and a brief explanation would be much appreciated.

  • 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-10T13:21:43+00:00Added an answer on June 10, 2026 at 1:21 pm

    Here are the direct answers. I kept them short because they won’t make sense without an understanding of regex. That understanding is best gained at http://www.regular-expressions.info/tools.html. I advise you to also try out the regex helper tools listed there, they allow you to experiment – see live capturing/matching as you edit the pattern, very helpful.

    Simple parentheses ( ) around something makes it a group. Here you have (?=) which is an assertion, specifically a positive look ahead assertion. All it does is check whether what’s inside actually exists forward from the current cursor position in the haystack. Still with me?
    Example: foo(?=bar) matches foo only if followed by bar. bar is never matched, only foo is returned.

    With this in mind, let’s dissect your regex:

     /^.*(?=.{4,})(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).*$/
    
    Reads as:
        ^.* From Start, capture 0-many of any character
    (?=.{4,}) if there are at least 4 of anything following this
    (?=.*[0-9]) if there is: 0-many of any, ending with an integer following
    (?=.*[a-z]) if there is: 0-many of any, ending with a lowercase letter following
    (?=.*[A-Z]) if there is: 0-many of any, ending with an uppercase letter following
        .*$ 0-many of anything preceding the End
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know a little bit about TextWatcher but that fires on every character you
I know very little about Agile but I wonder if there is any difference
I'm trying to set up authentication on my server, however, I know little about
I'm actually translating some C++ code (which I know very little about, and have
I know very little about encryption/hashing. I have to hash an encryption key. The
I know very little about Flash, and so is not programming in it. I
Pardon me if this has already been asked (I know very little about Data
The code here is X++. I know very little about it, though I am
First, please be gentle, I know very little about DB design. I am working
I'm talking about both server-side and client-side. I know a little bit about Go,

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.