Ask Your Question
0

How replace " ' " by " \' "

asked 2018-11-19 16:34:49 -0600

QuentinBtd gravatar image

updated 2018-11-20 23:48:47 -0600

Shruthi gravatar image

Hello,

For many reason, I use a curtom JDBC Query ton populate my database. But I'm facing a problem with strings containing simple quotes.

So, I have to place a backslash front of my simple quotes.

I try to replace " ' " by " \' " in my field using :

${str:replace(record:value("/features/properties/address"), str:unescapeJava('\''), str:unescapeJava('\\''))}

I tried many things but nothing works...

Maybe you could help me, and I hope it would help many other people.

edit retag flag offensive close merge delete

Comments

I found a solution ; My problem was to insert simple quote in mysql query. I try to put a backslash front of my simple quote, but I found a more easily soluce : https://stackoverflow.com/questions/887036/how-to-escape-single-quotes-in-mysql

QuentinBtd gravatar imageQuentinBtd ( 2018-11-26 02:32:13 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-11-21 14:29:44 -0600

QuentinBtd gravatar image

Thanks, I tried it but...

EXPR_00 - Invalid expression '${str:replaceAll(record:value('/features/properties/name'), str:unescapeJava(" ' "),\ )}': com.streamsets.pipeline.api.el.ELEvalException: CTRCMN_0101 - Error parsing expression ${str:replaceAll(record:value('/features/properties/name'), str:unescapeJava(" ' "),\ )}: javax.servlet.jsp.el.ELException: Encountered "\", expected one of [<integer_literal>, <floating_point_literal>, <string_literal>, "true", "false", "null", "(", "-", "not", "!", "empty", <identifier>]

edit flag offensive delete link more
0

answered 2018-11-20 23:40:39 -0600

Shruthi gravatar image

updated 2018-11-20 23:41:28 -0600

Use processor 'Expression Evaluator'. Give ${str:replaceAll(record:value('/field_name'), str:unescapeJava(" ' "),\ )}

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2018-11-19 16:34:49 -0600

Seen: 66 times

Last updated: Nov 21