First, you are trying to use extended regular expressions (ERE) but Sed uses basic regular expressions (BRE) by default. Namely, () for grouping and + for "one or more" is ERE. For more details, read why does my regular expression work in X but not in Y?. To activate ERE, use the -E flag (but we will not need it for the solution).
Even that would not be enough, because you are also matching comment:(\w+), but
- You don't re-introduce
comment:. Put it in the substitution slot.
- Being
\w a GNU extension to match word characters, (\w+) is not "everything up to the next ;" as the question claims, that would be [^;]*.
The solution is
sed 's/comment:[^;]*/comment:bar/g'
comment:tags? Your use of/gseems to indicate that there might be. – Kusalananda Mar 22 '21 at 11:27