SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot Tikila's Avatar
    Join Date
    Jun 2007
    Location
    Toronto
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strip_tags But Allow Some?

    Hi guys,

    Hope someone good with reg expressions can help me out with this.
    Am using this snippet to sanitize a string but would like to allow the slash (/) in this rule:

    PHP Code:
    $string preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i''$1'$string); 
    $string preg_replace(array('~[^0-9a-z]~i''~-+~'), ' '$string); 
    Appreciate your time looking at 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)
    If you are trying to work with HTML and sanitize it then you should use: HTML Purifier - Filter your HTML the standards-compliant way!
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



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
  •