I'm not sure it is any better because it is certainly more complicated,
but here is another regex that would remove similar expressions from an
sed 's/\([ ,]\)user[,]*/\1/g ; s/,\([ $]*\)/\1/g'
The first expression removes either leading "user" options or embedded
ones within a string and the latter one removes a trailing comma remnant
from a ",user" at the end of an options string (it also checks for and
preserves trailing blanks, not just end of line). If you don't care
about trailing blanks etc. the latter expression reduces easily to
sed 's/\([ ,]\)user[,]*/\1/g ; s/,$//'
Get latest updates about Open Source Projects, Conferences and News.