s/,42\b|\b42,|^42$//; # Or s/\b(?:,42|42,|42)\b//; # Or s/\b42,|,?42\b//;