Replacing "$" regex with null


#1

Hello there, I have a moderately sized source code, and it have a little bit of an issue,
I am currently working on android ROM building and the code is a part of it that needs to be compiled.

The issue is that the creator worked on it(I can’t contact them) have a weird way of defining functions in C
the define functions like this:
static int
MyFunction(){
;
}

so as you can see, this is a problem.
i am using ATOM editor to work on my project(this, rom building)and I am trying to correct this silly pattern they have here.

What i thought of doing is searching the project for regex: "int$"
so it will give me a list of all the int with next line just after it. so i want to replace that “next line character” with a " "(space).
My question is, Can I do that in ATOM?
Or, if there’s any other way that some of you know of to fix this code?

if you might want to take a look at the code, it is present at github.com/SscSPs/android_vendor_marvell_generic
the part that is affected is under sd8787 folder in the project.

Please, someone help.


#2

You can probably search for line-break (\n or \r\n on windows) and replace those by a space.
You’ll need to activate regex for those special characters to have meaning.

For example search
static int\n
and replace by
static int


#3

Nope, doesn’t work that way.
I tried already.
\n doesn’t even searches for the line breaks…
$ does find the line breaks

“int$” will wind all of them, “int\n” will find none.
At least on Ubuntu, that is the case


#4

What is the line ending (bottom left status bar)?

just tested and \r\n is needed for CRLF
while \n works in LF mode

The reason I don’t go in the direction is that produce a zero length match before the newline, while you want to match the newline to remove it.