How to replace ALL matched sub strings with RegExpReplace?

How to replace ALL matched sub strings with RegExpReplace?

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

publicaciones de 4 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

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

Thanks, it works.

-Evan

Cita:

Igor Belyakov (Intel) escribió:

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."

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya