I'm creating a system to allow some users update parts of their site.

1. I'm using CFFILE action="read" to pull the file.
2. Then I'm pulling out sections within divs to be replaced.
3. These sections are placed in forms allowing users to update them and then
using CFFILE to update the file by writing over the existing file.

OK, so far so good. The problem is in the regex. It works -- but not as it
should?!?

<cfset title = REreplace(readFile,'^.*<div
id="newsletterBody">(.*)</div>.*$','\1','all')>

I read the regex above as

Scan through string readFile

1. start at the begining ^.*
2. find <div id="newsletterBody">(.*)</div>
3. group 1 is everything between the <div>s

That DIDN'T WORK !!! OK, what to do? Let's put a stop. Search for everything
except for a ">"

4. Replace (.*) with ([^>]*)
This worked fine except for the fact that there are <P>s and <BR>s.
Alrightly then use a @ as the stop.
5. I replaced ([^>]*) with ([EMAIL PROTECTED]) and put a @ between the <div>s. That
didn't work!!!
6. After much fumbling I put the @ after the <div>s. That worked. Go figure?

QUESTION:

Isn't group 1 ([EMAIL PROTECTED]) between the <div>s. Why would the @ work outside
the <div>s?


I have
<div id="newsletterBody">
lorem ipsum whatever<P>
lorem ipsum more<P>
stuff<P>
</div><!-- @ -->

Thanks for any insight.

Gilbert Midonnet







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to