Skip to content

Global search and replace with regex does not correctly replace #2803

Description

@sterretjeToo

Describe the problem

A sketch was delivered with additional line feeds; demo code below

#define hello

#include <SoftwareSerial.h>

#include <FastLED.h>

void setup() {

}

void loop() {
}

E.g. between the two include statements

A search correctly finds them

Image

but a replace does not work correctly / as expected; replacing \n\n with \n results in the below

#define hello\n

#include <SoftwareSerial.h>\n

#include <FastLED.h>\n

void setup() {\n

}\n

void loop() {
}

To reproduce

Create a sketch with some additional empty lines.
Try to replace using a regular expression

Image results in the unexpected behaviour.

Expected behavior

The expected behaviour is that additional empty lines are removed.

Arduino IDE version

2.3.7-nightly-20251025

Operating system

Windows

Operating system version

Win 11

Additional context

Detected while using IDE 2.3.6.
Sketch was not saved.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions