[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2145
  • Last Modified:

REG_EXTRACT capture all prior to the last word as return value = 1 and last word =2

I am using below to capture the last word of a given string:
REG_EXTRACT(EMER_CONTACT_NAME,('.*(\w+)\s(\w+)'),2)
The value(s) returned is as expected, it is the last word in the string prior to the last instance of whitespace.  What I need is a way to extract the entire string just prior to the last word as a return value.  Below only provides the first word prior to the first \s:
REG_EXTRACT(EMER_CONTACT_NAME,('(\w+)\s+.*(\w+)'),1)
I need to find a way to find the entire string to include additional \s just prior to the last word.  Pleased if someone could assist who knows Informatica well as regex does not always play by the same rules in transformations.

Thanks
0
gNome
Asked:
gNome
1 Solution
 
wilcoxonCommented:
This should do it:

REG_EXTRACT(EMER_CONTACT_NAME,('(.*\w+)\s+(\w+)'),2)

I'm not positive on the correct value of the last integer argument (eg 2).
0
 
Terry WoodsIT GuruCommented:
This should include the space prior to the last word as part of the first result.

REG_EXTRACT(EMER_CONTACT_NAME,('(.*\w+\s+)(\w+)'),2)

ps: I don't know Informatica.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now