0

I have some document text I'm trying to convert to json and I have some description fields that include newlines I want to remove and quotes I need to escape. I'm using the Intellij editor with regex and am not sure how to define the regex that matched just the description field lines not the other fields & remove the newlines within it.

for example a snippet of the kind of character text is in the document.

description: "dsfsdf
sdf"title"
sdfsd9so 233 f
f:sd!f
sdfsdf",

other: "data",
field: "data",
date: "data",

description: "here is more descripton with new lines and quotes
sdf "info"
sdfs'df
fsd-f.(riro)
sdfsdf",

other: "data",
field: "data",
date: "data",

I tried search of:

description: "((([^\n]+)\n\s+)+)

replace with:

description: "$1 

I would like the result to be

description: "dsfsdf sd\"title\" sdfsd9so 233 f f:sd!f sdfsdf",

other: "data",
field: "data",
date: "data",

description: "here is more descripton with new lines and quotes sdf \"info\" sdfs'df fsd-f.(riro) sdfsdf",

other: "data",
field: "data",
date: "data",
claya
  • 1,762
  • 1
  • 15
  • 31

0 Answers0