I am attempting to write a regular expression to help locate some carriage return issues. I generated a string at the beginning of each line that I know should start that line. So I can assume that if the line does not contain that string there was a carriage return.
I was able to do it like so:
\n[^SOMEWORD]
the \n
also gets the previous lines space so in the Replace With section I would like to replace that with a backspace so that line will be moved back up but retain that data.
SOMEWORD,111111,22222222,null,null,"1333333
4444",55555,66,null,7777777,8888 99999,null,null,null,0,null,false,false,1212121,null,null,null,false,null,null,333333,null
SOMEWORD,111111,22222222,null,null,"1333333
4444",55555,66,null,7777777,8888 99999,null,null,null,0,null,false,false,1212121,null,null,null,false,null,null,333333,null
would look like:
SOMEWORD,111111,22222222,null,null,"1333333, 4444",55555,66,null,7777777,8888 99999,null,null,null,0,null,false,false,1212121,null,null,null,false,null,null,333333,null
SOMEWORD,111111,22222222,null,null,"1333333, 4444",55555,66,null,7777777,8888 99999,null,null,null,0,null,false,false,1212121,null,null,null,false,null,null,333333,null
CodePudding user response:
You can search using this regex:
(?m)\n(?!SOMEWORD,|$)
And replace with ", "
string.
RegEx Details:
(?m)
: Enable multiline mode\n
: Match a line break(?!SOMEWORD,|$)
: Assert that there is noSOMEWORD,
or an empty line ahead