How to extract middle name in Informatica Power center

You might use REG_EXTRACT in an expression to extract middle names from a regular expression that matches first name, middle name, and last name.

For example, 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 = Fernando
Code language: JavaScript (javascript)

In this example the subPatternNum 2 will extract the middle name from the full name input string.

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.