Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mat007g
Contributor III
Contributor III

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,

Labels (2)
1 Reply
vapukov
Master II
Master II

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,}',' ')