php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #49327 missing documentation
Submitted: 2009-08-22 02:21 UTC Modified: 2009-08-24 00:01 UTC
From: layton at layton dot tk Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: linux
Private report: No CVE-ID: None
 [2009-08-22 02:21 UTC] layton at layton dot tk
Description:
------------
the preg_match documentation and its relatives assume that the reader knows what all the special characters mean that make up a possible regular expression. I know that "everybody" knows perl -- except that a lot of people don't, and I know that "everybody" uses regular expressions, except that I wouldn't know if a perl regular expression would be the same as a lex regular expression.

PS. your obsoleted regular expression functions are well documented. but those regular expressions don't work here, so I presume something has changed, although I wouldn't know what.

PPS. when I was googling for answers, I found somebody who said that an ! meant something about an assertion, but neither he nor I understood what that might mean. 

Reproduce code:
---------------
---
From manual page: function.preg-match
---
@^(?:http://)?([^/]+)@i

Expected result:
----------------
The man page says that I should expect this to match on the domain name part of a url.

What I expected was some place that said 
@ means .......
^ means .......
( means .......
and so on.

Actual result:
--------------
confusion. The examples don't mean much when you don't know what the special characters mean.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-22 19:57 UTC] niel dot archer at blueyonder dot co dot uk
PCRE is documented at http://www.pcre.org/
 [2009-08-22 23:17 UTC] torben@php.net
The syntax is also quite heavily documented in the PCRE section of the PHP manual, under 'PCRE Syntax': http://www.php.net/manual/en/reference.pcre.pattern.syntax.php

The only reason I haven't marked this as Bogus is that perhaps the preg_*() function entries could use a 'See also' link to the syntax page.
 [2009-08-23 06:26 UTC] torben@php.net
On second thought, the current documentation makes this information clearly available, especially in the online manual where there is a link right from the same page clearly labeled 'Regular Expressions (Perl-compatible)'--which hopefully the interested reader would take the time to click. Even in other generated versions of the documentation, this information is easily found within the PCRE section of the manual with only a minimum of effort.
 [2009-08-24 00:01 UTC] layton at layton dot tk
I see. Now that I know what the shorthand notes mean, I can find the docs. Thanks.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 13:00:02 2026 UTC