英文:
How to write regex or any replace function to replace with null where [,-] pattern exist
问题
Input:
abc-cde@gmail.com,-cde@gmail.com,-efg@gmail.com
ghi@gmail.com,-acf@gmail.com
Output:
abc-cde@gmail.com,cde@gmail.com,efg@gmail.com
ghi@gmail.com,acf@gmail.com
英文:
I am trying to create logic using informatica to replace wherever ',' followed by '-' exist [,-] replace with null.
Input :
abc-cde@gmail.com,-cde@gmail.com,-efg@gmail.com
ghi@gmail.com,-acf@gmail.com
Output :
abc-cde@gmail.com,cde@gmail.com,efg@gmail.com
ghi@gmail.com,acf@gmail.com
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
得分: 0
请展示你的代码,因为很可能你做错了什么。在你的情况下,REPLACESTR函数应该是可以正常工作的。
语法:
REPLACESTR ( CaseFlag, InputString, OldString1, [OldString2, ... OldStringN,] NewString )
请参考这个例子:
REPLACESTR( 1, WEBLOG, '"', 'GET ', ' HTTP/1.1', NULL )
输入:
""GET /companyinfo/index.html HTTP/1.1"
结果:
/companyinfo/index.html
看起来下面的代码应该适合你的需求:
REPLACESTR( 1, inputField, ',-', NULL )
英文:
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 )
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论