2 parts to a string find/replace issue

Six Stars

2 parts to a string find/replace issue

Hi all,

 

I want to see how I could achieve 2 things.

 

1.  Search and replace a string with blank for everything inside brackets including the brackets. e.g. 

    original text: articulate the interaction of ecology with human society, including policy and legal frameworks for management of biological resources (K, A, E, I)

   New Text: articulate the interaction of ecology with human society, including policy and legal frameworks for management of biological resources

 

2.  With that text inside the brackets, get it and put it into a new field.  This time not including brackets.

 

original

Field 1                                       Field 2

werwerwr (K,A,E,I)

 

original

Field 1                                       Field 2

werwerwr                                    K,A,E,I

 

 

Thanks in advance


Accepted Solutions
Highlighted
Employee

Re: 2 parts to a string find/replace issue

Hi,

 

    Please refer the screen shot below for job output.

image.png

 image.png

 

 

 

The transformations to be used are as below

 

For string first part ->     

row1.input_data.substring(0,row1.input_data.indexOf("(")) 

For string second part ->   

row1.input_data.substring(row1.input_data.indexOf("(")+1,row1.input_data.indexOf(")")) 

If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome :-)

 

Warm Regards,

 

Nikhil Thampi


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)

All Replies
Highlighted
Employee

Re: 2 parts to a string find/replace issue

Hi,

 

    Please refer the screen shot below for job output.

image.png

 image.png

 

 

 

The transformations to be used are as below

 

For string first part ->     

row1.input_data.substring(0,row1.input_data.indexOf("(")) 

For string second part ->   

row1.input_data.substring(row1.input_data.indexOf("(")+1,row1.input_data.indexOf(")")) 

If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome :-)

 

Warm Regards,

 

Nikhil Thampi


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)
Six Stars

Re: 2 parts to a string find/replace issue

Thanks Nikhil Thampi, worked a treat.

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads