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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:52:19+00:00 2026-06-04T10:52:19+00:00

Okay, I’m currently trying to create bbcodes for my home made forum. It worked

  • 0

Okay, I’m currently trying to create bbcodes for my home made forum. It worked good, until I started with quotes. This is my function:

public function forum_parse ($string)
{
    global $core, $path;
    $string = $this -> normal_parse ($string);

    $search = '/\[quote=([A-z0-9 -_\'"]+);([0-9]+)\](.*)\[\/quote\]/is';
    $replace = '<div class="quote"><p class="quote-author"><a href="' . $path . 'forum/viewtopic?p=$2">' . WRITTEN_BY . ' $1</a></p><p class="quote-content">$3</p></div>';

    return preg_replace ($search, $replace, $string);
}

It works good when there’s one quote per post, but when there’s more, the problems begin. It obviously doesn’t start from the root quote and choose accurate end tags by itself. And I’ not experienced with RegEx enough to fix it. Any help? :/

  • 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-04T10:52:20+00:00Added an answer on June 4, 2026 at 10:52 am

    .* will consume as much as it can. Changing it to .*? will make it consume as little as it can, which should fix the problem … just as long as you don’t consider nested quotes.

    A better solution, I believe, would be to use the answers to this post instead of inventing your own.

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

Sidebar

Related Questions

Okay so i am currently trying to create a support ticket system, i have
Okay, so I'm trying to make a game that uses this algorithm: http://www.codeproject.com/Articles/15573/2D-Polygon-Collision-Detection But
Okay so I made this program to help me out with my homework and
Okay I have spent the last 2 days trying to sort this one out.
Okay, so in this program I'm making, users will be able to create shortcuts
Okay, This may be really simple or it may not even be possible, or
okay so this is probably a soft pitch question for sombody, but I want
Okay, I have done a bit of searching online and found this thread, but
Okay, before you guys go nuts -- this is just a small site, temporary
Okay people, I'm sure someone has had this issue and can help me out.

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.