Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

'ReplaceText" processor does not replace special characters as a "Replacement Value"

avatar
Rising Star

I have a 'Control A' separated file. I am trying to append each line with a date value with the regular expression,

${srcdelim}${now():format('mm-dd-yy')}

where ${srcdelim} contains the value '\u0001' from a schema file.

Apparently, the output file contains the string \u0001 rather than a control A delimiter.

I have attached my sample input and output.

Character Set: UTF-8

1 ACCEPTED SOLUTION

avatar
Guru

@bala krishnan

It works for me when I set Replacement Strategy to "Literal Replace":

9753-screen-shot-2016-11-23-at-15440-pm.png

my input file has control-a (but no \001) and my output file has control-a followed by test.

When I use the default Replacement Value ("Regex Replace") my output file has \001test

View solution in original post

4 REPLIES 4

avatar
Guru

Could you include a sample of two records? Please update your question with the sample.

avatar
Master Guru

is this UTF-8?

avatar
Super Collaborator

Rather than using \u0001 can you try \cA for the control A character? Reference : http://www.regular-expressions.info/nonprint.html "Many regex flavors also support the tokens \cA through \cZ to insert ASCII control characters. The letter after the backslash is always a lowercase c. The second letter is an uppercase letter A through Z, to indicate Control+A through Control+Z. These are equivalent to \x01 through \x1A (26 decimal). E.g. \cM matches a carriage return, just like \r, \x0D, and \u000D. Most flavors allow the second letter to be lowercase, with no difference in meaning. Only Java requires the A to Z to be uppercase."

avatar
Guru

@bala krishnan

It works for me when I set Replacement Strategy to "Literal Replace":

9753-screen-shot-2016-11-23-at-15440-pm.png

my input file has control-a (but no \001) and my output file has control-a followed by test.

When I use the default Replacement Value ("Regex Replace") my output file has \001test