0

I have a large data set that I'd like to convert into a workable csv file. The dataset currently looks like this:

[att1]; [att2]; [att3]; [att1]; (...)

To make this a workable csv-file, I'd need to insert a line-break after every third semi-colon.

[att1]; [att2]; [att3];
[att1]; [att2]; [att3]; (...)

Using VS Code's find and replace feature, how can I achieve this?

1
  • I am open to using other methods/software. If you know any, please mention them in a comment.
    – Ben
    Commented Jun 2 at 0:10

1 Answer 1

3

See regex101 demo

If your data is all on one line with the formatting you showed - [.*?]; then

Find: ((\[.*?\]; ?){3})
Replace: $1\n

seems to do the job. It finds 3 of those att's with an optional space between them and adds a newline after that group of three.

If your data doesn't actually have the []'s, like att1; att2; att3; you can use this find:

Find: ((.*?; ?){3})

Not the answer you're looking for? Browse other questions tagged or ask your own question.