Question

I have a JSON file. There is some information I want to delete and the process would be quite tedious to be done manually, and incredibly quick to perform through RegEx.

I want to find matches starting by, let's say, "abc" (including quotes), composed by any set of characters (including conflicting ones like brackets), and ending by , (the comma character), new line and " (left quote character).

Although RegEx is not my best strength, I have read several questions that could be related, like this one, and tried out several patterns, being this the one in which I believe the most:

"abc"(.*),^"

But it doesn't work properly. It starts fine, but the part after the (.*) is completely ignored, so the rest of the text in the document is selected instead of only what I requested.

Was it helpful?

Solution

^ doesn't mean newline. It's a "zero-length anchor" that matches the position before the first character of a line.

You want something like

"abc"(.*),\r?\n"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top