in reply to Howto strip 42 from comma separated list using s///
Update: Added the case for a single element of just "42" per Not_a_Number's and Perl Mouse's suggestions. Good catch; that's what a quick solution gets me, I didn't test all cases. I should note too, the position of 42 at the end of the list is important, so the regex engine doesn't try and grab that without looking for commas first.s/(,42\b|\b42,|^42$)//g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Howto strip 42 from comma separated list using s///
by Not_a_Number (Prior) on Nov 03, 2005 at 13:34 UTC | |
|
Re^2: Howto strip 42 from comma separated list using s///
by Perl Mouse (Chaplain) on Nov 03, 2005 at 14:08 UTC | |
by jbware (Chaplain) on Nov 03, 2005 at 14:21 UTC | |
|
Re^2: Howto strip 42 from comma separated list using s///
by Perl Mouse (Chaplain) on Nov 03, 2005 at 13:37 UTC |