Hey
guys
Got a
quick regular _expression_ question
What I
am trying to do is extract all the <script> blocks from a html page.
This is what I have so far
<[sS][^>]*>([\w\W\S\s]*)(</script>)?
no
whats happeneing is if there is more than one script block on the page, its
grabing the script block and everything in between
for
example
==========================
<cfsavecontent variable="bla">
<script language=_javascript_>
hasMsgr = 0;
function dontGotIt(){
hasMsgr = 0;
document.login_form.hasMsgr.value=0;
}
function doGotIt(){
hasMsgr = 1;
document.login_form.hasMsgr.value=1;
}
<script language=_javascript_>
hasMsgr = 0;
function dontGotIt(){
hasMsgr = 0;
document.login_form.hasMsgr.value=0;
}
function doGotIt(){
hasMsgr = 1;
document.login_form.hasMsgr.value=1;
}
</script>
xxxxxxxxxxxxxxxxxxxxxxxxx
<script language=_javascript_>
hasMsgr = 0;
function dontGotIt(){
hasMsgr = 0;
document.login_form.hasMsgr.value=0;
}
function doGotIt(){
hasMsgr = 1;
document.login_form.hasMsgr.value=1;
}
xxxxxxxxxxxxxxxxxxxxxxxxx
<script language=_javascript_>
hasMsgr = 0;
function dontGotIt(){
hasMsgr = 0;
document.login_form.hasMsgr.value=0;
}
function doGotIt(){
hasMsgr = 1;
document.login_form.hasMsgr.value=1;
}
</script>
</cfsavecontent>
<cfset scripts = ArrayNew(1)>
<cfset ArrayCounter = 0>
<cfset regExp = "<[sS][^>]*>([\w\W\S\s]*)(</script>)?">
<cfset stuff = REFindNoCase(regExp,bla,1,true)>
</cfsavecontent>
<cfset scripts = ArrayNew(1)>
<cfset ArrayCounter = 0>
<cfset regExp = "<[sS][^>]*>([\w\W\S\s]*)(</script>)?">
<cfset stuff = REFindNoCase(regExp,bla,1,true)>
================================
like
this, its getting all of the content and is looking at the last </script>
tag as the closing tag rather than looking at the content containing 2 script
blocks.
any
ideas on how to get this working?
Regards
Steve Onnis
Domain Concept Designs
+61 422
337 685
+61 3 9431 4249
| http://www.domainconceptdesigns.com
[EMAIL PROTECTED] |
http://www.cfcentral.com.au [EMAIL PROTECTED] |
http://www.devedit.com [EMAIL PROTECTED] | ||
("If you think it can't be done, you haven't asked me!") - Steve Onnis
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
