View.find_all(pattern, <flags>, <format>, <extractions>) [Region]
Returns all (non-overlapping) regions matching the regex pattern. The optional flags parameter may be sublime.LITERAL, sublime.IGNORECASE, or the two ORed together. If a format string is given, then all matches will be formatted with the formatted string and placed into the extractions list.lstpos = view.find_all(pattern, <flags>, <format>, lstrepl)
for pos, repl in zip(lstpos, lstrepl):
view.replace(edit, pos, repl)castles_made_of_sand wrote:Remember, if you have a static list of regions, you should make modifications from the end of the buffer to the beginning, else you smash your offsets
lstpos = view.find_all(pattern, <flags>, <format>, lstrepl)
for pos, repl in reversed(zip(lstpos, lstrepl)):
view.replace(edit, pos, repl)Users browsing this forum: No registered users and 2 guests