" /> Remove Carriage Return - Genesys CTI User Forum

Author Topic: Remove Carriage Return  (Read 2542 times)

Offline brenosilva

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Remove Carriage Return
« on: January 11, 2017, 03:57:06 PM »
Advertisement
Hi guys,

I'm using the follow Screening Rule [b]RegExFind("(?s)(?<=<Data1>)(.*)(?=</Data1>)", "v_data1")[/b] to capture na information that was between <Data1> and </Data1> tags.

The result of this rule is v_data1 ='Data1; Data2 ; Data3;

Data4;'

There is a carriage return in the text.

I couldn't remove the carriage return using StrReplace[v_data1, Char[10], ''] or StrReplace[v_data1, Char[13], ''].

There is a way to remove these carriage return in Regex or in the IRD?

Offline Dorian-Grim

  • Newbie
  • *
  • Posts: 16
  • Karma: 1
Re: Remove Carriage Return
« Reply #1 on: January 11, 2017, 04:49:36 PM »
Try both char codes in one string replace.

Offline brenosilva

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Remove Carriage Return
« Reply #2 on: January 11, 2017, 05:24:28 PM »
I did a research in Genesys Care and I found this:

[i]"There is no availability to remove line breaks  using StrReplace function"[/i]

I really don't know RegEx very well, there is a way to remove line breaks using RegEx? As I know, Screening Rules don't allow the method replace, just find.

There is another way to remove these line breaks from an attach data?

Offline victor

  • Administrator
  • Hero Member
  • *****
  • Posts: 1419
  • Karma: 18
Re: Remove Carriage Return
« Reply #3 on: January 17, 2017, 01:55:36 AM »
The fastest thing (and stupidest) that comes into my mind is to break the attach data into separate pieces using the character/word/length and then trim them out from each separate key and then assemble again, if need to.

We had something similar a while back; however, we handled it on an app side that was giving us CRLF. We replaced them with <JORGE>

Vic

Offline terry

  • Sr. Member
  • ****
  • Posts: 328
  • Karma: 35
Re: Remove Carriage Return
« Reply #4 on: January 17, 2017, 06:25:32 PM »
Basically StrReplace replaces any chars (if their code is known) including line breaks.
Did you try something like following sequence:
v_data1 = StrReplace[v_data1, Char[13], '']
v_data1 = StrReplace[v_data1, Char[10], '']

If it doesn't work - may be first checks which exactly codes presents line break - codes= Bytes[v_data1, 10].