Log in

View Full Version : regex help in Expression Web



Chadi
09-05-2008, 03:39 AM
I'm using MS Expression Web for simple html pages on my forum.

I have the entire Matthew Henry commentary done on basic old-school html (by another person). I'm trying to clean it up.

The footer has this for example:


<HR>
<TABLE WIDTH="100%">
<TR>
<TD ALIGN="CENTER" VALIGN="BOTTOM">
<a href="http://www.gregwolf.com"
target="_top"><b>Greg Wolf's Bible Prophecy Home Page</b></a><br><br><a href="http://www.gregwolf.com/mhc-download.htm" target="_top"><b>Free Download - Matthew Henry's Complete Commentary</b></a><br><br><a href="http://www.biblehelpsonline.com/mhc/index.htm" target="_top"><b>Please visit - Matthew Henry's Concise Commentary - in Large Print</b></a><br><br>CREDITS: <A HREF="http://ccel.org"><B>Christian Classics Ethereal Library</B></A><br><br>
<A HREF="mailto:support@gregwolf.com?SUBJECT=Matthew_Henry's_Commentary_on_the_Whole_Bible:_Genesis_VII.">E-Mail support@gregwolf.com</A><BR>
</TD></TR></TABLE>
<HR>

Each page has this, but the "SUBJECT" for each page is unique

Example.

SUBJECT=Matthew_Henry's_Commentary_on_the_Whole_Bible:_Genesis_VII.
SUBJECT=Matthew_Henry's_Commentary_on_the_Whole_Bible:_Genesis_IX.

I'm trying to figure out how I can search all the html files (opened) and use regex to replace those with nothing (blank). Regex is new to me, so I need help here. I confirm that expression web does have regex search feature built in.

james438
09-05-2008, 09:13 PM
This will not be the most helpful post, but you might not get a response right away, because what you are asking for is a bit complex. Not difficult as far as I can tell (and I am usually wrong in this regard), but a bit time consuming.

I am not familiar with MS Expression Web, but using PHP

You need a program that will list all of the files in a folder. Using a loop open them a file and assign the contents to a string. Use str_replace() (not regex) to replace all of the material you want removed with nothing then save the document. The program will then move on to the next document in your folder to scan for the offending code. You may also need to use sessions or htaccess for security. I kinda doubt you will need security for what you are talking about though.

regex is interesting, but I recommed using it as little as possible since it is rather processor heavy. I am thinking of PCRE in particular.

Just as a little plug for MySQL I suggest taking the Mathew Henry chapters and storing them in a database. This way you will only need one simple file for all of Matthew Henry. This may not make too much sense now, but when you are free try taking a look into it.