-3

i would like your help to help me create a regex that will replace each "\r\n" syntax to a new line, like this example:

POST / HTTP/1.0\r\nHost: mywebsite.net\r\nConnection: close\r\nContent-Length:
400\r\nContent-Type: text/xml; charset=utf-8\r\nUser-Agent: Apache-
HttpClient/4.5.1 (Java/1.8.0_74)\r\nAccept-Encoding: gzip,def1ate

To this:

POST / HTTP/1.0
Host: mywebsite.net
Connection: close
Content-Length: 400
Content-Type: text/xml; charset=utf-8
User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_74)
Accept-Encoding: gzip,deflate

many thanks!

Paul L
  • 939
  • 4
  • 14
  • Please provide more details on where you are trying to write your Regex. – techspider May 26 '16 at 18:12
  • What language are you using? – Bohemian May 26 '16 at 18:15
  • You don't need regex to solve your problem. Just use simple plain-text replacement in whatever language you're using. For example in java: `String formatted = str.replace("\\r\\n", "\n");` or replace with `"\r\n"` as you like – Bohemian May 26 '16 at 18:18
  • Possible duplicate of [replace '\'n in javascript](http://stackoverflow.com/questions/14072313/replace-n-in-javascript) – Ani Menon May 26 '16 at 18:20

1 Answers1

0

Sorry for that. I am using java pattern class to evaluate regular expressions. It is on a graylog system that collect the access log (request and response) from the server. extractor configuration

I was trying to make \\r\\n and replace with \r\n but it didnt help.

rap-2-h
  • 30,204
  • 37
  • 167
  • 263