Autor: Philip Hazel Data: Para: Supratik Goswami CC: pcre-dev Asunto: Re: [pcre-dev] Unable to get the no. of occourance of a character
inthe subject string.
On Mon, 23 Jun 2008, Supratik Goswami wrote:
> I am using PCRE library to find the no of occourance of a character,
> for example if the subject is like "ABAABCDAB" and the number of
> occourance I want to find for A should return 4.
If you really do just want the number of occurrences of one character,
then I would advise you just to scan the string and count. Using PCRE is
way over the top.
> Can you please help me with a small example program that finds the
> occourance of a character in a subject string.
If you want to repeatedly match in a string using the basic PCRE
functions, you need to write a loop and call pcre_exec repeatedly. There
is such a loop in the pcredemo.c sample program.