1
votes

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~(.*?)\|.*')
1

1 Answers

1
votes

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.