Re: [pcre-dev] Problem with regex

Kezdőlap
Üzenet törlése
Szerző: Philip Hazel
Dátum:  
Címzett: Salvatore Iovene
CC: pcre-dev
Tárgy: Re: [pcre-dev] Problem with regex
On Tue, 11 Dec 2007, Salvatore Iovene wrote:

> Hi, the following regex matches in Perl but not with pcre.
>
> "/^\\*\\*\\*\\*\\s*Starting\\s*FICS\\s*session\\s*as\\s*([^*]+)\\*\\*\\*\\*$/m"
>
> The text that I'm trying to match is a multilined text that has one
> line like this:
>
> **** Starting FICS session as foobar ****
>
> Help appreciated, thanks!


It works in pcretest:

$ pcretest ~/tmp/zz
PCRE version 7.4 2007-09-21

/^\*\*\*\*\s*Starting\s*FICS\s*session\s*as\s*([^*]+)\*\*\*\*$/m
**** Starting FICS session as foobar ****    
 0: **** Starting FICS session as foobar ****
 1: foobar 


Even when that is not the first line:

$ pcretest ~/tmp/zz
PCRE version 7.4 2007-09-21

/^\*\*\*\*\s*Starting\s*FICS\s*session\s*as\s*([^*]+)\*\*\*\*$/m
ABCD\n**** Starting FICS session as foobar ****\nXYZ
0: **** Starting FICS session as foobar ****
1: foobar

Philip

--
Philip Hazel