I need to replace environment new line to @

I have this Data:

10 ABCDEF this, is the description,100AUR 15.03.2019 5 AUR 216,56 2.080,36 AND
Agreed 90,00 % 326,48 - AND
Gross Value For Item 1.664,67 AND
15.03.2019 1 AUR
31.03.2019 4 AUR
NOT FOUND 1 AUR

20 DEFGHI this, is the description, (72 aur) NA 10 AUR 458,12 1.080,34 AND
Agreed 90,00 % 216,45 - AND
Gross ValueFor Item 46,56,78,64 AND

30 EDFTHI this, is the description, NA 5 AUR 67,67,89,23 AND

40 EDFTHI this, is the description, NOT FOUND 5 AUR 67,67,89,23 AND

50 ZZZZZZZZZZZ ZZZZZZZZZZZ available 1 AUR 12,34,56,78 AND

I need like this:

10 ABCDEF this, is the description,100AUR 15.03.2019 5 AUR 216,56 2.080,36 AND
Agreed 90,00 % 326,48 - AND
Gross Value For Item 1.664,67 AND
15.03.2019 1 AUR
31.03.2019 4 AUR
NOT FOUND 1 AUR
@
20 DEFGHI this, is the description, (72 aur) NA 10 AUR 458,12 1.080,34 AND
Agreed 90,00 % 216,45 - AND
Gross ValueFor Item 46,56,78,64 AND
@
30 EDFTHI this, is the description, NA 5 AUR 67,67,89,23 AND
@
40 EDFTHI this, is the description, NOT FOUND 5 AUR 67,67,89,23 AND
@
50 ZZZZZZZZZZZ ZZZZZZZZZZZ available 1 AUR 12,34,56,78 AND

Thanks
Chethan P

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Replace(yourString,"(?<=\r?\n)(?=\r?\n)","@")

Regards,

1 Like

If you Dont Mind could you please explain this code

Thanks
Chethan P

Hi,

(?<=XX) means lookbehind. It matches position which just after its string (in this case \r?\n : linebreak)

(?=XX) means lookahead. It matches position which just before its string (in this case \r?\n : linebreak)

So (?<=\r?\n)(?=\r?\n) means position between continuous two \r?\n.

Regards,

1 Like

Thank you verry much then what is that \r
\n is the new line but \r means

@copy_writes - Carriage Return …

1 Like

means give some example please

@copy_writes - please check here…

https://www.regular-expressions.info/nonprint.html

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.