
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
modify html file, replace image src
Hi Talend geeks,
if I use tFileInputRaw on a html file as string can I modify the string in order to replace inside the
image tag the path to another url, to <img src="https://example/content/header.jpg" style="width: 538px" alt=""/></td>?
If yes, how to replace the substring?
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
Try this code on tJavaRow to replace "folder/header.jpg" with "https://example/content/header.jpg", and assign the new string to a context variable for used later on tSendMail.
//Code generated according to input schema and output schema
context.varName= input_row.content.toString().replace("folder/header.jpg","https://example/content/header.jpg");
System.out.println(context.varName);
Regards
Shicong

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
Try this code on tJavaRow to replace "folder/header.jpg" with "https://example/content/header.jpg", and assign the new string to a context variable for used later on tSendMail.
//Code generated according to input schema and output schema
context.varName= input_row.content.toString().replace("folder/header.jpg","https://example/content/header.jpg");
System.out.println(context.varName);
Regards
Shicong

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot, instead of tSendMail I put behind tJavaRow --> tFileOutputRaw and then tSendMail.
So I can iterate all my html, modify and send it.
