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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:10:15+00:00 2026-05-31T04:10:15+00:00

In a simple template parser anywhere $00 , $11 , etc. appears in the

  • 0

In a simple template parser anywhere $00, $11, etc. appears in the HTML it is being removed. I don’t see what’s in my pattern that is causing $10 to be stripped from the replacement.

What is strange is I’ve commented out nearly all of my code except the main preg_replace function that handles the tag. Seemingly there is no connection, but nearly everything else has been removed.

Function (not showing what’s commented out):

public function output() {
    $output = file_get_contents($this->file);

    foreach ($this->values as $key => $value) {
        $dynamic = preg_quote($key);
        $pattern = '%\[@'.$dynamic.'.*?\]%';
        $output  = preg_replace($pattern, $value, $output);     

        if ($key == 'objective') {
            $objective = $value;
        }
    }
}

HTML Excerpt:

[if @objective]<div id="objective">[@objective]</div>[/if]

Original value of ‘objective’ (ie, $value):

Obtain a position at XYZ Company where $words $100 !100 maximize my management skills, quality assurance, program development, and training experience.

New value of ‘objective’:

Obtain a position at XYZ Company where $words 0 !100 maximize my management skills, quality assurance, program development, and training experience.

  • 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-31T04:10:16+00:00Added an answer on May 31, 2026 at 4:10 am

    (Follow-up to comment on the question.)

    $xx (where x is a digit) is used for backreferences in the replacement string of preg_replace. If you want the replacement string to contain $xx, you have to escape it:

    $value = preg_replace('/\\$\\d+/', '\\\\$0', $value);
    

    This will replace $xx by \$xx in $value.

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

Sidebar

Related Questions

I'm using the PHP simple DOM parser for filling an HTML template; it seems
i have a simple template that i populate with some data then im trying
In HTML I can build a simple templating system by providing a template in
I've been working on a parser for some template language embeded in HTML (FreeMarker),
I've got a simple (but not tiny) template for some HTML, complete with inline
My goal here is to create a very simple template language. At the moment,
I'm trying (and failing) to write a simple template file: <#@ template language=C# hostspecific=True
I try to use assignment_tag from django docs: https://docs.djangoproject.com/en/1.4/howto/custom-template-tags/#howto-custom-template-tags-simple-tags Test project: mysite/ manage.py polls/
I have the following simple button with an image as the template. The problem
Is there a simple way to define a master template for my whole rails

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.