简体   繁体   English

如何在informatica中提取字符串中的特定值

[英]How to extract specific values in a string in informatica

I need to extract the ( , ) , - and numbers from 0 to 9 from the input field phone number.我需要从输入字段电话号码中提取( , ) , -和从 0 到 9 的数字。

For eg., for input data: (891)456-567A$rT67例如,对于输入数据: (891)456-567A$rT67

Output should be (891)456-56767 Output 应该是(891)456-56767

can be done in below 2 steps -可以通过以下2个步骤完成 -

v_ph_no = REG_REPLACE( in_ph_no,'[^0-9]','')` -- variable port that will replace everything but 0 to 9.
out_ph_no = '(' || substr(v_ph_no,1,3)||')' || substr (v_ph_no,4,3)||'-' || substr (v_ph_no,6) -- o/p port that will create ph no in desired format.

Explanation - first remove all unwanted characters and then format it in desired phone no format.说明 - 首先删除所有不需要的字符,然后将其格式化为所需的电话无格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM