Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
JS regex strip <script>...</script>

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side
View previous topic :: View next topic  
Author Message
fun.ky



Joined: 05 Jan 2006
Posts: 365
Location: Mostar

PostPosted: 28.09.2008 10:54    Post subject: JS regex strip <script>...</script> Add user to your forum ignore list Reply with quote

Pozdrav,
Kao što u naslovu stoji, treba da u stringu pronađem sve <script>....</script> i izvučem sadržaj između script tagova pomoću regex-a.

Ima li neko prijedlog ?

_________________
There is no style definition for good music!
Back to top
View user's profile Send private message Visit poster's website Twitter profile
fun.ky



Joined: 05 Jan 2006
Posts: 365
Location: Mostar

PostPosted: 29.09.2008 12:30    Post subject: Add user to your forum ignore list Reply with quote

Ok Smile

Ako neko bude trebo sličnu stvar evo JS Funkcija

Code:
function GetElementValue(InStr, Tag)
{
    var pattern = "<" + Tag + ">(([^<]|\n)*)</" + Tag + ">";
    var re = new RegExp(pattern, "m");
    var arr = re.exec(InStr);

    if (arr != null)
    {
            return arr[1];
    }
    else
    {
            return "";
    }
}

_________________
There is no style definition for good music!
Back to top
View user's profile Send private message Visit poster's website Twitter profile
rdavl



Joined: 24 May 2007
Posts: 31
Location: Zadar

PostPosted: 29.09.2008 14:05    Post subject: Add user to your forum ignore list Reply with quote

Code:
r'<script [^>]*>([^<]*)<\/script>'


Ovo je iz glave, nisam siguran da ce ti raditi ovakav.
Downside je ne smije postojati znak "<" nigdi u JS kodu.

_________________
"Meow" means "woof" in cat.
Back to top
View user's profile Send private message
fun.ky



Joined: 05 Jan 2006
Posts: 365
Location: Mostar

PostPosted: 29.09.2008 21:19    Post subject: Add user to your forum ignore list Reply with quote

Meni baš treba nešto što može parsirati i string gdje se nalaze znakovi < > neko riješenje i za to ?

_________________
There is no style definition for good music!
Back to top
View user's profile Send private message Visit poster's website Twitter profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group