Forum Moderators: coopster

Message Too Old, No Replies

regular expression problem.

         

esllou

12:27 pm on Dec 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have to replace large blocks of text on my site's page with OTHER large blocks of text.

the problem is that the original text is different page by page, but only by a little. For example, I have to replace:


<!-- july 25 2004 -->
<HTML>
<HEAD>
<TITLE>Poster Store - Adolphe-William Bouguereau Posters and Adolphe-William Bouguereau Prints</TITLE>
<META NAME="description" CONTENT="All types of posters - fine art, historical, vintage. Adolphe-William Bouguereau posters.">
<META NAME="keywords" CONTENT="Adolphe-William Bouguereau posters, poster store, vintage posters, advertising posters">

on one page, and then on another:


<!-- july 4 2004 -->
<HTML>
<HEAD>
<TITLE>Poster Store - Salvador Dali Posters and Salvador Dali Prints</TITLE>
<META NAME="description" CONTENT="All types of posters - fine art, historical, vintage. Salvador Dali posters.">
<META NAME="keywords" CONTENT="Salvador Dali posters, poster store, vintage posters, advertising posters">

what is the correct syntax in R.E. to mean "any amount of characters, 0-9, a-z" so I can eliminate all the differing key words and words in the title?

esllou

1:20 pm on Dec 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



well I seem to be having some success using {.*} as a wildcard. Didn't work on whole blocks but am doing well replacing bit by bit: still a lot quicker than if I'd had to do it by hand.

am a regex dummie, I know... :-)

coopster

4:19 pm on Dec 5, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what is the correct syntax in R.E. to mean "any amount of characters, 0-9, a-z"

// zero or more 
[0-9a-z]*
// one or more
[0-9a-z]+