SPUG: removing a special character

luis medrano lmzaldivar at gmail.com
Tue Oct 3 13:39:03 PDT 2006


Works great, but how I keept the spaces?



On 10/3/06, Miles Crawford <mcrawfor at u.washington.edu> wrote:
>
>
>
> Crap!
>
> How about this instead:
>
> $foo = 'string\' with b at d `chars';
>
> $foo =~ s/[^a-z0-9]//ig;
>
> I forgot the 'g' - the first one only removed the first bad char.
>
> You may also want to add a ' ' to the a-z0-9 bit to preserve spaces.
>
> -miles
>
>
>
>
> On Tue, 3 Oct 2006, Miles Crawford wrote:
>
> >
> >
> > Luis,
> >
> > Try something like this:
> >
> >
> > $foo = 'string\' with b at d `chars';
> >
> > $foo =~ s/[^a-z0-9]//i;
> >
> > But read http://perldoc.perl.org/perlre.html first ;)
> >
> > -miles
> >
> >
> > On Tue, 3 Oct 2006, luis medrano wrote:
> >
> >> List,
> >>
> >> I need to remove this character ' but I'm using linux if I copy paste
> >> it will show something like this â. any idea how can I fix this or
> >> how can I just remove everything except numbers and letters?
> >>
> >> Thanks,
> >> luis
> >> _____________________________________________________________
> >> Seattle Perl Users Group Mailing List
> >>     POST TO: spug-list at pm.org
> >> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
> >>    MEETINGS: 3rd Tuesdays
> >>    WEB PAGE: http://seattleperl.org/
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/spug-list/attachments/20061003/3230d0fe/attachment-0001.html 


More information about the spug-list mailing list