Current location: Hot Scripts Forums » General Web Coding » JavaScript » javascript regular expression


javascript regular expression

Reply
  #1 (permalink)  
Old 08-19-05, 02:47 PM
chet chet is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
javascript regular expression

I have a small problem with a regular expression in javascript
I use this one for putting double quotes around html tags

for example border=0 will became border="0"

unclean = unclean.replace(/ ([^=]+)=([^"' >]+)/gi," $1=\"$2\"");

It searches for = and then put the "" around the html tags

However I have one problem with javascript in html

for example
document.write("<a href=\"javascript:popUp

will became document.write("<a href="\""javascript:popUp
and
document.write("&js=on');
will became 'atedocument.write("&js="on'");

My question is how to escape everthing if it defined into a script tag
<script

Thanks for any help I am really stuck here :)
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
regular expression for parsing url link musmanm80 Perl 1 07-27-05 11:58 PM
Regular Expression KHWright Visual Basic 0 06-02-05 06:40 PM
I want a crowler and abstraction from Regular Expression oiranoinu Script Requests 4 11-25-04 11:31 PM
Regular Expression IP Address Replacement CMIVXX PHP 3 11-20-04 07:27 AM
suggest a regular expression gmadhukarreddy Perl 2 01-08-04 12:56 AM


All times are GMT -5. The time now is 10:54 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.