Re: [pcre-dev] Using pcre: the /g behaviour

Kezdőlap
Üzenet törlése
Szerző: Philip Hazel
Dátum:  
Címzett: jonetsu
CC: pcre-dev
Tárgy: Re: [pcre-dev] Using pcre: the /g behaviour
On Thu, 23 Feb 2012, jonetsu wrote:

> pcredemo segfaults when using the -g param, as in the following (cmd
> on a single line) :


Thanks for the report. I will see if I can reproduce it on my 32-bit
system. I have to admit that pcredemo.c hasn't been touched since
November 2010, so it is quite possible that it has decayed. :-) It
hasn't been part of my regular testing routine, but perhaps it should
be.

> I'm new to pcre (since yesterday) and I think this is solved, from
> what I can see so far, by adding a call to pcre_fullinfo() in order to
> somehow give some meaning to name_table before tabptr shifts that
> value:


Thanks also for taking the time to do some debugging. It's always
helpful to have somewhere to start when investigating a problem.

> If there is no other catch in proceeding like this, it seems quite
> straightforward. Not bad at all. Can I ask what would be the pcre
> syntax to use to cope with a paragraph (Linux newlines) instead of a
> single line using this -g functionality ?


Well, pcredemo really is supposed just to be a demonstration program for
the edification of people who want to write code that calls PCRE. That's
why it isn't part of the PCRE normal build. However, there is a proper
search program called pcregrep (which *is* part of the PCRE build) that
does grep-like searches. This has a -M (or --multiline) option that
allows searches to span newlines.

Philip

--
Philip Hazel