Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    568
    Thanks
    6
    Thanked 84 Times in 84 Posts

    Remove script tags

    Hi,
    I have a regular expression which removes anything between <script> and </script> tags. The problem comes when there is more than one on a page, eg.

    Code:
    <script>lose this</script>
    content I want to keep
    <script>lose this</script>
    Everything in that string is removed... how can I limit it to complete tags only?

    I did a search but could only find ones that either remove tags only, or have the same problem as mine.

    Cheers,
    Gus
    Last edited by gusblake; 12-08-2009 at 10:03 PM.

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,075
    Thanks
    38
    Thanked 498 Times in 492 Posts
    Post what you are using so we can see what you have done.

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Posts
    568
    Thanks
    6
    Thanked 84 Times in 84 Posts
    I fixed it just now, someone on the PHP site had a function to remove specified tag and contents so I used that.

  • #4
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,075
    Thanks
    38
    Thanked 498 Times in 492 Posts

    Arrow

    Quote Originally Posted by gusblake View Post
    I fixed it just now, someone on the PHP site had a function to remove specified tag and contents so I used that.
    Was it a PHP or JS solution?

    If JS, post what you did so that others might learn.


  •  

    LinkBacks (?)


    Posting Permissions

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