How to write regex or any replace function to replace with null where [,-] pattern exist

205 views Asked by At

I am trying to create logic using informatica to replace wherever ',' followed by '-' exist [,-] replace with null.

Input :

[email protected],[email protected],[email protected]
[email protected],[email protected]

Output :

[email protected],[email protected],[email protected]
[email protected],[email protected]

I have tried REPLACESTR,REPLACECHAR but its not working as pattern its considering both of them as single character and replacing wherever it is , or -.I need to build logic where it consider it as pattern of ,followed by - and then replace.

1

There are 1 answers

1
Maciejg On BEST ANSWER

Please show your code, as most likely you're doing something wrong. The REPLACESTR function should be working perfectly fine in your scenario.

Syntax:

REPLACESTR ( CaseFlag, InputString, OldString1, [OldString2, ... OldStringN,] NewString ) 

Check this example:

REPLACESTR( 1, WEBLOG, '"', 'GET ', ' HTTP/1.1', NULL )

Input:

"GET /companyinfo/index.html HTTP/1.1"

Result:

/companyinfo/index.html

Seems the following should work for you:

REPLACESTR( 1, inputField, ',-', NULL )