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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:06:52+00:00 2026-05-19T17:06:52+00:00

I found this regex on a forum: /\+?\)\)(=.+?,.+?)?\](.+?)\[\/quote\](?!((.*?)\[\/quote\]))/s The regex should be able to

  • 0

I found this regex on a forum:

"/\+?\)\)(=.+?,.+?)?\](.+?)\[\/quote\](?!((.*?)\[\/quote\]))/s"

The regex should be able to extract data from a string. I will give you an example:

<?php
$string = ‘[quote=username]bla bla bla bla[/quote]’;

preg_match("/\+?\)\)(=.+?,.+?)?\](.+?)\[\/quote\](?!((.*?)\[\/quote\]))/s", $string, $match, null, 0);

print_r($match);

… However, nothing is returned to $match. I am guessing that there is something wrong with the regex, since it should return both ‘username’ and ‘bla bla bla bla’.
I am going to use the function for a quote function in a forum.

Thanks in advance,
fischer

  • 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-19T17:06:52+00:00Added an answer on May 19, 2026 at 5:06 pm

    I would use something a little easier to read…

    $string = '[quote=username]bla bla bla bla[/quote]';
    
    preg_match('/\[quote=(.*?)\](.*?)\[\/quote\]/', $string, $matches);
    
    print_r($matches);
    

    Output

    Array
    (
        [0] => [quote=username]bla bla bla bla[/quote]
        [1] => username
        [2] => bla bla bla bla
    )
    

    See it on IDEone.

    I assume your string will contain more than that – hence lazy quantifiers and no beginning and end anchors.

    Also, make sure your string is delimited by single (') or double quotes ("), not backticks. Backticks are syntactic sugar for a shell_exec() call.

    Update

    I’ll try and decipher your original regex for you…

    /\+?\)\)(=.+?,.+?)?\](.+?)\[\/quote\](?!((.*?)\[\/quote\]))/s
    
    
    /  -> start delimiter
    \+? -> optional '+'
    \) -> literal ')'
    \) -> literal ')'
    (=.+?,.+?)? -> not sure the reason for this (enlighten me?)
    \] -> match literal ']'
    (.+?) -> match one or more characters ungreedy
    \[\/quote\] -> match ending '[/quote]'
    (?! -> negative lookahead
    ((.*?) -> match 0 or more characters ungreedy
    \[\/quote\] -> match ending '[/quote]'
    ))
    / -> ending delimiter
    s -> case insensitive flag
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found this in a message forum, I don't know regex so I was
okay i found this regex from Stack overflow, which can isolate the URL and
found this regex: insert every 10 characters: $text = preg_replace(|(.{10})|u, \${1}. , $text); can
I need a regex expert to help out on this one. Examples I've found
Found this is some example CSS I was reading and I'm having a hard
I found this regex at http://gskinner.com/RegExr/ to validate a FQDN domain: (?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]{1,63}(?<!-)\.?)+(?:[a-zA-Z]{2,})$) it basically
Regex is not really my thing. But i have this in my php file
I found this regex which works fine if there are no alphabets in provided
I've found this regex in a script I'm customizing. Can someone tell me what
I found this regex which finds prices like 1.00 or $1.00. But it also

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.