
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to get the double quotes from the description field, which was in double quote text enclosure
Hi All,
I've a file which was pipe | delimiter and text are enclosed with the double quotes. One of my incoming field has double quotes in data (For Example "XCFDGHJ "A" updated") . The expected output for me was
XCFDGHJ "A" updated
But in Talend I was getting as XCFDGHJ
Can you please help me on how to
achieve this requirement.
I can't disable the csv option in tFileInputDelimiter as I might get | pipeline also in the description field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi , if pipe is a field delimiter you can clean your file before :
Read it with a fileInputRaw as a unique string
then in a t javarow or a tmap : (your string).replaceAll("\\"","")
then you write it in a fileoutputRaw
finally you can read the cleansed file.
Send me Love and Kudos

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think this code will replace all double quotes, bc want to keep the double quotes around "A".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
With CSV option, you have to contain escape char in source file. eg:
"XCFDGHJ\"A\"updated"
Regards
Shong

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your answer!
While using row7.content.replaceAll("\\"","") getting error "String literal is not properly closed by a double-quote"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
my fault :
row7.content.replaceAll("\"","")
it will replace all the double quote of the document

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
StringUtils.replaceAll((your string),"(?<!\\|)\"(?!\\|)","\\\\\"") will replace all double quote not precedeed by | and not folowed by | with \"
it will work if the first and last field of your row are not enclosed with "

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you.
But I can't predict the escape char for each row as it was description field, difficult to get the desired format. Is there any generic format in escape character that will not consider an double quoted data within the enclosed text.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But I can't predict the escape char for each row as it was description field,:
In fact you can predict it :
StringUtils.replaceAll((your string),"(?<!\\||^)\"(?!(\\||$))","\\\\\"")
will work for every double quote inside a field enclosed by double quote
