How to split first & last name from a full name In informatica Power center? There are few ways to do this but the recommended and the easy way is to use the function REG_EXTRACT. This function Extracts subpatterns of a regular expression within an input value.
#syntax
REG_EXTRACT( subject, 'pattern', subPatternNum )
subPatternNum is in integer value
no value or 1. Extracts the first regular expression subpattern.
2. Extracts the second regular expression subpattern.
n. Extracts the Nth regular expression subpattern.Code language: PHP (php)Let’s see an example now, I have an input port for full_name and I want to split and assign the full name as First, Middle & last name. Let’s identify the regular expression for the input string name field. I am sure that my input name will always comes with a pattern first_name(space)middile_name(space)last_name and so the corresponding pattern will be (\w+)\s+(\w+)\s+(\w+)
\s => Matches a whitespace character.
\w => Matches one alphanumeric character, including underscore (_)
FIRST_NAME = REG_EXTRACT( full_name, '(\w+)\s+(\w+)\s+(\w+)', 1 )
MIDLE_NAME = REG_EXTRACT( full_name, '(\w+)\s+(\w+)\s+(\w+)', 2 )
LAST_NAME = REG_EXTRACT( full_name, '(\w+)\s+(\w+)\s+(\w+)', 3 )
If the full_name is "Juan Carlos Fernando", the output will be like
FIRST_NAME = Juan
MIDLE_NAME = Carlos
LAST_NAME = FernandoCode language: JavaScript (javascript)
Have any questions? or need help with this topic, please do reach out to me at kvtinformatica@gmail.com. Don’t forget to follow my Youtube channel and FB page, Lets stay connected and learn together.