Szerző: jonetsu Dátum: Címzett: pcre-dev Tárgy: Re: [pcre-dev] Using pcre: the /g behaviour
Le Vendredi 24 Février 2012 11:29:26 +0000 (GMT),
Philip Hazel <ph10@???> a écrit :
> 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.
Thanks for the comments. Actually I'm using the demo to quickly see
what is possible to do. My goal is to include a specialized search
method in an existing application. So far I have an array of named
search items, in sequence for the search, which is fed one by one to
iterations of the pcre_exec() as per the demo, each time retrieving a
named substring value.
What I'd like to have is a return of a 2D array (names and values)
based on the regex itself and the names it may contain. Not sure at
the moment but I think it is possible to see if there were any names in
the last search and if there were, to get them names and then feed them
one by one to the copy substring method to reap as it iterates, pairs
of names/values without the need of giving the names in the first place.