[pcre-dev] [Bug 1337] Named Captures not working

Góra strony
Delete this message
Autor: Philip Hazel
Data:  
Dla: pcre-dev
Temat: [pcre-dev] [Bug 1337] Named Captures not working
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1337

Philip Hazel <ph10@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID





--- Comment #1 from Philip Hazel <ph10@???> 2013-03-03 16:59:42 ---
I am afraid I don't know anything about PHP programs. I have attempted to
create a plain copy of your pattern for testing with the pcretest program, and
it captures the named substrings just fine. I may, of course, not have
understood exactly how PHP works. However, a couple of things in your pattern
look wrong:
(?P\' for instance. Assuming the \ is taken away by PHP, you end up with (?P'
which is not valid PCRE syntax for naming a subpattern. The valid syntax is
either Perl's (?'name' or (?<name> or Python's (?P<name>. Also, there seems to
be a / in your pattern before the final ~ delimiter, which is never going to
match your data.

This is my test:

PCRE version 8.32 2012-11-30

~\{language\s*=\s*(?'quote'[\\"']*)(?P<att>.*?)(?P=quote)\s*\}~
fdfdfdfdf{language=1}testhgg\Gquote\Gatt
0: {language=1}
1:
2: 1
G (0) quote
G 1 (1) att

The escapes \Gquote and \Gatt in the data request the output of the captured
patterns.

I am closing this as a non-bug.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email