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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:01:12+00:00 2026-06-17T15:01:12+00:00

Alright, so this is linked to a previous question I had. I am very

  • 0

Alright, so this is linked to a previous question I had. I am very new to PHP in general, and simply only need it to fix something someone else did to work for a forum of mine.

This is what I currently have:

// Alter post output to create links to user profiles
$post->message = preg_replace(
   '/@ *('.preg_quote($speak['username'], '/').')[:,.]? */i',
'[url=\''.PAGE_URL.RELATIVE_WBB_DIR.'/index.php?'
. 'page=User&userID='.$speak['toID'].'\']@'.$ speak['username'].':[/url]',
                              $post->message);

This should change:

@JamesNorris, @JamesNorris: @JamesNorris

to user profile links, and it does. The only problem is that the other change it makes is this:

@JamesNorris:@JamesNorris:@JamesNorris:

That is the output from that line given before.
Apparently it is removing the ‘,’ and whitespace, and placing a ‘:’.

Does anyone have any ideas on how to fix this problem?

  • 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-17T15:01:14+00:00Added an answer on June 17, 2026 at 3:01 pm

    You can capture the ,:. as its own group and reference that in the replacement:

    ('preg_quote(...)')([:,. ])? */i',
       '[url...'.$speak['username'].'\2[/url]'
    

    The \2 is whatever was captured in the second group (colon, comma, period, space). It’s \2 because you already have another capture group for the username (that you don’t use).

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

Sidebar

Related Questions

Alright, this is a very simple question. I just installed Tomcat 6 on my
Alright I know this is more than likely a amateur question but I have
Alright this probably sounds easier than it is :) I've got two files: file1.php
Alright everyone this is a bit of a complicated setup so if I need
Alright, so this is getting very very annoying. I have an unmanaged VC 2010
Alright this is a follow-up to my last question: JTable: Changing cell background when
I have written this piece of code here and I have linked it alright
I'm wanting to do something in D3 that's very similar to what this guy
Alright - this may be a dumb question, but my desire for perfection is
Alright so I'm pretty new to this rails stuff so please bear with me...

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.