Multi-line regex search in whole file

前端 未结 6 968
悲哀的现实
悲哀的现实 2021-02-15 16:47

I\'ve found loads of examples on to to replace text in files using regex. However it all boils down to two versions:
1. Iterate over all lines in the file and apply regex to

6条回答
  •  生来不讨喜
    2021-02-15 16:53

    I would say you should pre-parse/normalize the data before doing your replacements so that each line describes one possible set of data that needs to have replacements applied. Otherwise you get into complications with data integrity that cannot really be solved without a host of other difficulties.

    If there is a way to chunk the data into logical blocks then you could build a program that uses a mapreduce pattern to parse the data.

提交回复
热议问题