Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Apr 2003
    Posts
    6
    Member #
    1156
    Say I have this:
    PHP Code:
            $newstring preg_replace($patterns$replacements$string); 
    Now, $string may or may not have HTML tags in it, and if it does, the replacement will most likely b0rk them. So, how can I make it so that it just ignores anything between '<' and '>'?

    EDIT: Also, how can I make it ignore anything between '&' and ';' along with that? Thanks.

  2.  

  3. #2
    Senior Member assassingod's Avatar
    Join Date
    Nov 2002
    Posts
    112
    Member #
    307
    Couldn't you try str_replace?
    PHP Code:
    $html = array("<"">"";""&");
    $string str_replace($html"""<b>hello</b>"); 
    the result will be bhello/b
    assassingod - vB.org Moderator :ichatsmile:

  4. #3
    Junior Member
    Join Date
    Apr 2003
    Posts
    6
    Member #
    1156
    I don't want to strip out the < and the >, I want it so that if I replace the letter 'a' with another character, it won't b0rk tags such as <a href="http://www.blah.tld"> and <span class="normal">.

  5. #4
    Senior Member assassingod's Avatar
    Join Date
    Nov 2002
    Posts
    112
    Member #
    307
    Ah right, I misread your post and though you wanted the < > to be removed. Sorry!
    assassingod - vB.org Moderator :ichatsmile:

  6. #5
    Junior Member
    Join Date
    Apr 2003
    Posts
    6
    Member #
    1156
    No problem. It's just that I translated vB3 into 2 types of leet using a script and now there are screwed up HTML tags everywhere in the admin cp while using one of them because of it. So I want to re-do it making it ignore any HTML.

  7. #6
    Senior Member assassingod's Avatar
    Join Date
    Nov 2002
    Posts
    112
    Member #
    307
    Ah right, I see what you mean.
    assassingod - vB.org Moderator :ichatsmile:

  8. #7
    Junior Member
    Join Date
    Apr 2003
    Posts
    6
    Member #
    1156
    EDIT: Using strtr fixed this problem. My initial question still stands.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:14 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com