I got one more problem. I dont' think Man page mentioned
about second matching on the same string, when I read it.
I tried call "i = regexec(r, argv[2]);" twice, but didn't move
forward after first match. I did found however
"i = regexec(r, r->endp[0]);" matches the second substring.
but I don't think it's meant to be used this way.
How do you match same pattern more than twice on the same line?
Well, typically, you would find a point in the line after the first
match, and use regexec to match there.
Why don't you think it's meant to be used this way? What seems unusual
to you about using the endpoint of a previous match as the starting place
to look to see whether there are any more matches? Why would you think
that it would "move forward" after the first match?
Because that is a quite reasonable expectation. Many search
facilities operate either operate that way or they have a 'next
instance' command. It is misleading to say that computers 'do what
you tell them to do'. Unless you are programming down to the bare
iron you don't tell computers what to do - you tell some piece of
software what to do. What that software does is (sometimes) what the
programmer who wrote it decided it ought to do. It is a serious
mistake to blame the computer for the design errors of the software
creators.