The Burp Suite User Forum will be discontinued on the 1st November 2024.

Burp Suite User Forum

For support requests, go to the Support Centre. To discuss with other Burp users, head to our Discord page.

SUPPORT CENTRE DISCORD

Create new post

Match and replace

Juan | Last updated: Jul 13, 2017 02:32AM UTC

Hello. How do I write a newline character in the Replace field, in "Match and Replace"? Which kind of notation is used? Is there any list of examples? Thanks in advance.

PortSwigger Agent | Last updated: Jul 13, 2017 07:20AM UTC

This isn't directly supported, but there is a workaround. Create your match and replace rule with an X where you want your newline. Click the cog icon and save the options. Then edit this JSON file and replace X with \r\n When you reload the options you will have a newline in your rule. Please let us know if you need any further assistance.

PortSwigger Agent | Last updated: Jul 13, 2017 07:23AM UTC

Hi Juan, Please follow the instructions I provided. They work fine on Burp Free for me.

Burp User | Last updated: Jul 14, 2017 10:04PM UTC

As I am using the free version, the rule is in registry, stored in HKCU\Software\JavaSoft\Prefs\burp\1.5free.proxy.matchreplacerule5 key. I tried what you suggested but it does not work. During execution, the replacement removes the slashes and keeps "rn" as if it were a normal string. Thank you very much.

PortSwigger Agent | Last updated: Jul 17, 2017 07:30AM UTC

Hi Juan, I've attached a couple of screenshots that show you how to save the JSON file. Burp uses Java regular expressions. This cheat sheet may help you: - http://www.omicentral.com/cheatsheets/JavaRegularExpressionsCheatSheet.pdf

Burp User | Last updated: Jul 19, 2017 11:44PM UTC

Thank you very much Paul. I was careful and did what you told me. I have no JSON file, only the key I mentioned, in the registry. And the result is as if the backslashes weren't there (I get the rn substring instead of a newline character). I am trying a replacement in the response body. Is there any document about the syntax of the "regular expressions" Burp use?

Burp User | Last updated: Jul 20, 2017 11:51PM UTC

Thank you very much Paul! I really appreciate your help. I updated to 1.7.23 version and studied the sheet. With kind regards, Juan

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.