In Javascript from the following string
filterExpress = %1 and %2 and %3 and % and %5 and %6 I need to remove anything following "% " (i.e % and a space) and before the immediately next occurrence of %.
So the output string should be-
%1 and %2 and %3 and %5 and %6 I've tried to use regexp as follows
filterExpress = filterExpress.replace(/ % .*[^%]/, ''); However, this doesn't match the results that I want.
Please help me giving a solution.