Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Service File cannot read lines with backslash (\)

SA-21523

Summary



A Service File rule using a Parse Delimiter rule to read a .txt file line by line fails if the text contains a backslash or the defined escape character.

Error Messages



com.pega.pegarules.pub.PRException: Error while parsing: Invalid escape sequence. Escape character must be followed by either field delimiter, or record delimiter, or another escape character.

Steps to Reproduce

  1. Set up a Service File rule using a Parse Delimiter rule to read a .txt file line by line.
  2. Use a file listener to implement the Service file rule. Check the box on the Process tab for generating the report file. Use delimiter \n and record terminator \n.
  3. Put a text file with a line that has a backslash.
  4. Start the file listener.


Root Cause



The Parse Delimiter code expects the defined escape character to escape a special character such as a field delimiter, record delimiter, or another escape character. This is what the escape sequence should do. The escape sequence followed by a non special character is an error.

Resolution



Perform the following local-change:
Select an escape character (single character sequence) that is unlikely to be in the data sets to be processed. As an example a cent sign might be appropriate.

Published April 1, 2016 - Updated October 8, 2020

Was this useful?

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us