Title: Message
Hi Steve,
 
I hate regexp, so I won't attempt to decipher yours.
 
Would it be an option to do a replacenocase on the html code, changing the first </script> to some other unique string?
Then use the regexp with the modified unique string.
 
Alternatively, you could do a findnocase on <script> and </script>, and then use the mid function to extract the code.
 
Probably less efficient, but would work.
 
HTH,
Phil.
 
 
----- Original Message -----
Sent: Friday, January 02, 2004 12:21 AM
Subject: [cfaussie] Regular Expressions Assistance

 
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>
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)>
================================
 
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
---
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

Reply via email to