Bug #66708 [Nab]: preg_match reports missing right-perand incorrectly
| From: | requinix@php.net | Date: | Thu, 13 Feb 2014 18:55:05 +0000 |
| Subject: | Bug #66708 [Nab]: preg_match reports missing right-perand incorrectly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-184292@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66708&edit=1
ID: 66708
Updated by: requinix@php.net
Reported by: jbeecher at oneendlessloop dot com
Summary: preg_match reports missing right-perand incorrectly
Status: Not a bug
Type: Bug
Package: Regexps related
Operating System: Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
http://www.php.net/manual/en/regexp.reference.escape.php
Previous Comments:
------------------------------------------------------------------------
[2014-02-13 18:37:24] jbeecher at oneendlessloop dot com
To add... normally if I'm going to specify any control character, I would use \x{5B} where
'5B' is whatever the hex code is I wish to check for. Please confirm that '\c'
is also for control characters, reference a source-document, and provide an example.
------------------------------------------------------------------------
[2014-02-13 18:33:40] jbeecher at oneendlessloop dot com
Okay. Per the PCRE docs I'm aware of the backslash character is used to escape the next
character to its literal form. I just wanted to make sure it saw it as a 'c'. I have
never seen PCRE consider backslash-c as a control character... If that's so, it's
undocumented.
------------------------------------------------------------------------
[2014-02-13 17:27:48] requinix@php.net
\c is supposed to be \cX, where X is a character. Together they form the escape sequence for a
control character. You've given it \c). You'd need another ) after that - except I
don't think you mean to use \c) in the first place.
------------------------------------------------------------------------
[2014-02-13 16:29:16] jbeecher at oneendlessloop dot com
Description:
------------
Valid regexp: /[a-z0-9]{1,25}\s+([0-9]{3,12})\s+[.]*(\-\c)/i
Test script:
---------------
Example data (to grep against):
blinky 5321 1 0 Feb07 ? 00:03:41 php ./di-sup.php -c 1 -i /ftpacct/max/pub/MAX -p
/ftpacct/max/pub/MAX -n mixlplick -l /home/blinky/M006615/custlogs/MAX -e reports@maxic-reports.com
-x rubber1333!
Expected result:
----------------
preg_match() should return an array of matched values.
Actual result:
--------------
preg_match() returned false (not zero, but boolean false) i.e. there was an error.
The error message was, "preg_match(): Compilation failed: missing ) at offset 43"
Which is incorrect.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66708&edit=1