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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:30:51+00:00 2026-06-13T04:30:51+00:00

I tried searching here and Google, but couldn’t find a solution to the following:

  • 0

I tried searching here and Google, but couldn’t find a solution to the following:

$picUrl = '"thumbs/phpThumb.php?src=../property-photos/50/2485/068cf6589a9fb13065818efef3d1e1c0-small.jpg&w=80&h=60&far=1&bg=EEEEEE"';
$number = "2485";
$expression = "'#".$number."/(.*?)&w#'";
echo "<b>expression is </b>".$expression."<br />";
echo "<b>picUrl is </b>".$picUrl."<br />";
preg_match($expression, $picUrl, $pic);  //'#2485/(.*?)&w#'
//if($pic) echo "pic is ".$pic[1]."<br />";
echo "<b>contents of pic array</b>".var_dump($pic);

As written above, the array is empty. However, if I replace the $expression variable in the preg_match function, with the text following the php comment (ie: '#2485/(.*?)&w#'), I get the desired result.

Why is the use of the $expression variable not working?

  • 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-13T04:30:53+00:00Added an answer on June 13, 2026 at 4:30 am

    $expression is a string starting with and ending with '. Thus, ' becomes the delimiter, and # becomes a literal in your regex. '#2485/(.*?)&w#' is a string starting and ending with # which now is a delimiter of the regex and not a literal.

    Simply use either this:

    $expression = "#".$number."/(.*?)&w#";
    

    or (which I recommend) this:

    $expression = '#'.$number.'/(.*?)&w#';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried searching here , but it couldn't help me much .. I want
I tried searching for this but couldn't find a similar question. I have a
I tried searching in google but could not find any useful answer, if(verifier.length() >
I've tried searching this on Google and here but nothing like the issue I'm
I tried a few of the fixes I found here searching around but they
Tried searching the site, but cannot find an answer to my problem: Lets say
I tried searching Google and this site for this, but it was hard to
I tried searching the compiler errors on google, but it didn't even return a
I've tried searching here and on google, i ended up with the GetDlgItem method,
I tried searching for information on this, but must not know the right terms

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.