If you want to replace all tags you could do something like the following
```dataview
TASK
WHERE !completed
AND contains(upper(text), "#TODO")
AND contains(upper(text), "#P2")
FLATTEN regexreplace(text, "#\S+\s?", "") as visual
SORT contains(file.tags,"P2"), text ASC
```
If you want to replace just a few tags, other variants of this replace could be used, i.e. regexreplace(text, "#(ToDo|P2)\s?", "")
which isn’t case insensitive though.