In a regular question where you want code to do something, a lot of information can be inferred from the situation. For example, if you provide Python code then we can infer you have a Python interpreter and need a Python solution. The code is the canvas and the tool and the language etc. for the solution.
In a "meta" question where you want to do something with code, suddenly a lot of information is not defined by the code itself. For example, just because you show Python code does not mean you can use Python code to work with it.1 The code is merely the object of the task and it says nothing about the rest.
A "meta" question must explicitly provide all the information that can be inferred in a regular question.
Practically, let us look at some missing pieces of information for your question.
What tool are you working with?
Refactoring is commonly done in an IDE, but many people use beefed-up editors such as NotePad++, and there are veritable use-cases for having refactoring scripts/programs. Even for just Regex there are different engines with their own capabilities and limitations.
All of these will allow – or prevent – wildly different approaches.
What cases do you need to cover?
The comprehension syntax is a much more complex and less standard thing than the usual runtime objects and values. For example, one can often infer whether "integer" is just a stand-in for "any number", yet for syntax... Do you need just list or also set, dict and generator displays as well? Do you need nesting? Do you expect comments? Newlines? Is the syntax actually always valid to begin with?
Define the requirements as closely as possible.2 If you need to rely on examples, provide multiple examples including pathological cases.
What is the goal of the task?
So you want to "refactor some Python modules which contain complex list comprehensions" – but why does that involve matching the comprehensions? For example, reformatting line breaks at comprehensions needs much less code understanding than refactoring comprehensions into loop statements. For many tasks there are quick and simple solutions if we just need to solve specific cases.
It can be a good idea to tie this to the example cases: Alongside each input case provide an example or description of the output or information desired.
1Anecdotally, while I have lots of reputation in the Python tag many of my day-to-day problems actually use the Puppet language to assemble such code.
2That also means using the appropriate technical terms. It is probably a good idea to look at how the language is defined.