I have a few signal flags in a serialized string and I need to remove the flag from the string when the user requests a certain operation. I was unable to find a regex that works in all cases for the below string.
var flags = "out:ab,bc,bcc,cd";
This is the closest I got (e.g. removing bc flag)
flags.replace(/[:,]bc\b/, "");
Result is out:ab,bcc,cd which is cool, but when removing ab I will get outbc,bcc,cd which is wrong. The result must always keep the string serialized, e.g. out:flag1,flag2
I tried capturing subpatterns but could not find an all-round working combo.
-- more info:
Flags are 0/1 signals, if a flag is present I must remove it.
Out: is the operation mode and it's the opposite of In: (this is a second group of flags). To put it simple, Out: is a "allow all, but blacklist these", where In: is "deny all, but whitelist these". The app can run in either mode. ab, bc, cd ... are sample alphabetical keys.
out? What's the expected output? That would clear things a bit.