SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Strip tease!

  1. #1
    FBI secret agent digitman's Avatar
    Join Date
    Sep 2004
    Location
    Work
    Posts
    697
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strip tease!

    How can I strip all non-alphanumeric characters from a string? The characters I want to allow are:
    A-Z
    0-9
    _ -

    Everything else can be stripped. How can this be done? Can anybody give me a hand with a regexp to do this?

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $result preg_replace('/[^\w\-]+/'''$subject); 
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    FBI secret agent digitman's Avatar
    Join Date
    Sep 2004
    Location
    Work
    Posts
    697
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much! I hope you get a strip tease soon .


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •