How to replace ALL matched sub strings with RegExpReplace?

How to replace ALL matched sub strings with RegExpReplace?

imagem de evanyan

Hi,

I'm using ippsRegExpReplace_8u() to replace matched sub strings, but didn't find a way to replace *ALL* the matched sub strings. Following is an example.

regex: [BD]
src string: ABCDE
replacement: ##
wanted dist string: A##C##E
actual dist string: A##

How to write regex and replacement to get my wanted dist string? Or IPP just doesn't support that?

What's more, even IPP only supports replacing the first occurrence of the matched sub strings, I would expect the dist string to be "A##CDE"...

Thanks,
-Evan

4 posts / 0 new
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de Igor Belyakov (Intel)

Hi,
There is 'const char* pOptions' parameter in the function ippsRegExpInitAlloc. You can change search strategy by passing combination of 'i', 's', 'm', 'x', 'g' characters. By default first matched substring will be replaced. Please set in to the 'g'. 'g'is global search. That means all matched substrings will be replaced.

Igor S. Belyakov

imagem de evanyan

Thanks, it works.

-Evan

imagem de christian s.

Quote:

Igor Belyakov (Intel) wrote:

Hi,
There is 'const char* pOptions' parameter in the function ippsRegExpInitAlloc. You can change search strategy by passing combination of 'i', 's', 'm', 'x', 'g' characters. By default first matched substring will be replaced. Please set in to the 'g'. 'g'is global search. That means all matched substrings will be replaced.

Igor S. Belyakov

So please update the documentation because its othewise denoted:
"All found matches are replaced according to the replacement pattern that is stored in the structure pReplaceState."

Faça login para deixar um comentário.