|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27949 preg_match cant match ?
Submitted: 2004-04-10 21:11 UTC Modified: 2004-04-11 05:44 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: drew at corrupt dot co dot nz Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 4.3.5 OS: FreeBSD 4.9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: drew at corrupt dot co dot nz
New email:
PHP Version: OS:


 [2004-04-10 21:11 UTC] drew at corrupt dot co dot nz
I am trying to match a question mark in PHP using preg_match() with the following attempt's described in the code section.

Neither work, while following documentation examples.

Reproduce code:
// String:
$line = "This is pretty much a [url=\"\"]Wiki[/url] but with a twist of [BBCode] and a few other site specific [Hacks]";

// Attempt #1:


// Attempt #2:


Expected result:
I expected that the values

"url=" and "" would be picked up from the regex into $parse.

It works with the following PERL one liner:

perl -e '$string = "This is pretty much a [url=\"\"]Wiki[/url] but with a twist of [BBCode] and a few other site specific [Hacks]"; @match = $string =~ m/\[(\/?[\w\d\-\_]+(=\"[\w\d\S\s\?]+?\")?)\]/; print "Match: " . join(",",@match) . "\n"'

Match: url="",=""

Actual result:
Matches nothing.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-11 00:07 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

RTFM: You need to use double backslashes to quote stuff..

 [2004-04-11 05:44 UTC] drew at corrupt dot co dot nz
I tried double backslashing aswel.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 27 07:03:34 2022 UTC