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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:33:18+00:00 2026-06-12T11:33:18+00:00

So I have this comment-esk like system I am working on, and apparently I

  • 0

So I have this comment-esk like system I am working on, and apparently I didn’t think it all the way through, however I am blocked into my method at this point for the time being and foreseeable future. That said.

I am currently using

$pattern = '/\[@(\w+):(.*)\]/';
$subject = '[@keyword:string]';
preg_match($pattern, $subject, $matches);

To find specific info from a particular pattern type. Which is something to the extent of [@keyword:string], and this works great. However in my searches to come up with this method of doing that it failed to dawn on me that the strings I am using this on also contain other stuff, such as a comment. So the over all string would look like ‘[@keyword:string]
Hello World`

The above bit of code will dump an array for me, first item the actual match I was looking for, the next being the keyword and the next the string. Which is great, as I use this for something else. However. Like I said I never compensated for the <br>Hello World part so. What I need to do is something very similar to the above. But only leave the <br>Hello World part as a reusable string as I am intent on rejoining the 2 strings. After my process is done. Except, the process after its done in this case is replacing the pattern I am looking for with a matching User Name, or an Image based on the keyword, which then dispatches a function to find the right name, or create the image tag for the image. Which thats fine I got that part, its just the stripping of the pattern from the string so when I get the name(s) or image back I can rejoin it to the string.

Well hopefully that makes sense.

  • 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-12T11:33:19+00:00Added an answer on June 12, 2026 at 11:33 am

    Use the one of the following patterns:

    '/\[@(\w+):(.*?)\]/'
    
    '/\[@(\w+):(.*)\]/U'
    

    Note: PCRE_UNGREEDY

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

Sidebar

Related Questions

I have this really weird bug at my page. I wrote this comment system
Suppose I have a comment block like this: /** * comment * comment *
in this variable: $this->item->text I have this string: <!-- JoomlaWorks Disqus Comment System for
I have a table that looks like this: comment_id, user_id, comment, last_updated. Comment_id is
I have this function for my comment system but it doesn't dynamically add the
i saw comment like this one place i have seen this problem is if
I have this link @Ajax.ActionLink(comment, CreateDebateComment, new { id = Model.DebateID}, new AjaxOptions {
I have this: $text = 'This is some text /*Comment 1 */ . Some
I have this in one of my haml views: -form_for :news_item_comment, :url=>{:id => comment.id,
I have this query, and I am trying to get the latest comment for

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.