suphero
suphero

Reputation: 517

Powercenter Informatica REG_EXTRACT issue

I'm having an issue about REG_EXTRACT function in Expression Transformation in Powercenter Informatica. It can't capture first occurrence when the value to capture ends with special character (e.g: ı or İ).

Successfully retrieving the value of the KEY2 as VALUE2

REG_EXTRACT('KEY1~VALUE1_ı|KEY2~VALUE2|KEY3~VALUE3|', '.*KEY2~(.*?)\|.*')

The value of the KEY1 should be VALUE1_ı, but the result is VALUE1_ı|KEY2~VALUE2

REG_EXTRACT('KEY1~VALUE1_ı|KEY2~VALUE2|KEY3~VALUE3|', '.*KEY1~(.*?)\|.*')

Upvotes: 1

Views: 1015

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 627082

I suggest using

REG_EXTRACT('KEY1~VALUE1_ı|KEY2~VALUE2|KEY3~VALUE3|', 'KEY1~([^|]*)', 1)

See the regex demo. The last argument (1) tells REG_EXTRACT to fetch just the Group 1 value.

The KEY1~([^|]*) regex matches KEY1~ and then captures any zero or more chars other than | into Group 1.

Upvotes: 1

Related Questions