ID:               27949
 User updated by:  drew at corrupt dot co dot nz
 Reported By:      drew at corrupt dot co dot nz
 Status:           Bogus
 Bug Type:         PCRE related
 Operating System: FreeBSD 4.9
 PHP Version:      4.3.5
 New Comment:

I tried double backslashing aswel.


Previous Comments:
------------------------------------------------------------------------

[2004-04-11 00:07:04] [EMAIL PROTECTED]

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 http://www.php.net/support.php 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-10 21:11:53] drew at corrupt dot co dot nz

Description:
------------
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=\"http://www.wiki.org/?WhatIsAWIki\"]Wiki[/url] but with a twist
of [BBCode] and a few other site specific [Hacks]";



// Attempt #1:

preg_match_all("/\[(\/?[\w\d\-\_]+(=\"[\w\d\S\s\?]+?\")?)\]/",$line,$parse);



print_r($parse);



// Attempt #2:

preg_match_all("/\[(\/?[\w\d\-\_]+(=\"[\w\d\S\s\\\?]+?\")?)\]/",$line,$parse);



print_r($parse);

Expected result:
----------------
I expected that the values



"url=http://www.wiki.org/?WhatIsAWIki"; and
"http://www.wiki.org/?WhatIsAWIki"; 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=\"http://www.wiki.org/?WhatIsAWIki\"]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="http://www.wiki.org/?WhatIsAWIki",="http://www.wiki.org/?WhatIsAWIki";

Actual result:
--------------
Matches nothing.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27949&edit=1

Reply via email to