Using regular expressions with Redshift

Six Stars

Using regular expressions with Redshift

Hi,

 

I am using a tRedshiftRow component to update a Redshift table. Within the update statement , I am using the Redshift regex_replace function to remove multiple consecutive whitespaces. If I execute the update statement outside of Talend, via a Redshift client, the update statement works as it should be. However, when being executed during via Talend, multiple whitespaces are not being replaced, but words containing 'ss' are being replaced with a whitespace.

 

The regex expression used is: regex_replace(word, '\\s{2,}',' ')

 

I tried removing one of the back-slashes but it gave an error. 

 

Any hints on how to solve this by keeping the query intact?

 

Thanks,

Forteen Stars

Re: Using regular expressions with Redshift

if You use this function in SQL code, like "select regex_replace(word, '\\s{2,}',' ') from ...", java look for \\ as for \

 

so You need use - regex_replace(word, '\\\\s{2,}',' ')

-----------

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now