Clean string

Discussion in 'Perl Misc' started by kjhjhjhjadsasda@urbanhabit.com, Aug 14, 2006.

  1. Guest

    Hi

    What would you suggest is the smoothest way of cleaning up a $string,
    eg remove any characters that are not:

    0-9 a-z : // /

    This is to clean various strings from special characters, spaces etc to
    make them clean as URLs.

    Thanks!
    , Aug 14, 2006
    #1
    1. Advertising

  2. wrote:
    >
    > What would you suggest is the smoothest way of cleaning up a $string,
    > eg remove any characters that are not:
    >
    > 0-9 a-z : // /
    >
    > This is to clean various strings from special characters, spaces etc to
    > make them clean as URLs.


    $string =~ tr!0-9a-z:/!!cd;


    John
    --
    use Perl;
    program
    fulfillment
    John W. Krahn, Aug 14, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt Garman
    Replies:
    1
    Views:
    292
    =?ISO-8859-2?Q?Milan_=C8erm=E1k?=
    Feb 16, 2004
  2. robert maas, see http://tinyurl.com/uh3t

    Requesting advice how to clean up C code for validating string represents integer

    robert maas, see http://tinyurl.com/uh3t, Feb 11, 2007, in forum: C Programming
    Replies:
    232
    Views:
    2,995
    Mark T
    Apr 16, 2007
  3. Replies:
    8
    Views:
    500
  4. abc
    Replies:
    27
    Views:
    8,803
    Kevin McMurtrie
    Dec 23, 2009
  5. Taisuke Yamada
    Replies:
    7
    Views:
    324
    David A. Black
    Apr 23, 2005
Loading...

Share This Page