Szerző: Philip Hazel Dátum: Címzett: Mihai Matei CC: pcre-dev Tárgy: Re: [pcre-dev] match on multiline strings containing '[ ]'
On Thu, 15 Nov 2007, Mihai Matei wrote:
> RegularExpr re("\\A[ \n\r\t]*<!\\[CDATA\\[([^\\]]+)\\]\\]>", RE_MULTILINES);
I presume that the actual regex that you want to pass to PCRE is
\A[ \n\r\t]*<!\[CDATA\[([^\]]+)\]\]>
> this regex fails to match on the string:
> <![CDATA[test 0 test1 \ntest2 [runPackage]:0]]></log>\n</xmlreport>
Well, yes, it will. After [CDATA[ your pattern expects a sequence of
not-] followed by ]] and your test string doesn't have that. After a
sequence of not-] your test string has ]:0]]
> but it matches on:
>
> <![CDATA[test 0 test1 test2 [runPackage]:0]]></log></xmlreport> ###(no newlines)
It doesn't match for me when I test with pcretest.
> <![CDATA[test 0 test1 \ntest2 runPackage:0]]></log>\n</xmlreport> ###(no square brackets inside CDATA)