Quick Nav:  Online Store   |   Login | Register

PB Updates Meta content... how to disable??

Rate this topic:

Please Register to post a reply. Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.
AuthorMessages
Nelson Fernandez
<100 Posts
Posts:50


01/11/2008 12:53 PM  

In a couple of my replace rules, the content I am looking for appears the the Meta tags content attribute. The content attribute gets replaced as one would normally want BUT in my case this causes the attribute to contain tags that mess up the display of my page.

A simple example in my scenario is where I want to bold a specific phrase, lets say "BOLD ME". The rule searches for the text and places the bold html tags around it. Now if your page description or keywords contain the term "BOLD ME", it will also replace in the meta tags resulting in the top of your website showing the keywords after the text.

I have tried to make another replace rule to remove the meta content, but it appears that either the rule is ignored or it is run before anything else and it gets repopulated as it normally would.

Finally I have tried to create a rule that would only replace text found within the body tags, but then it yeilds only a single replace instead of all occurances within the tags.

Is there a way to set the order in which the replaces get processed?

Any other hists as to how I can accomplish the replace without affecting the meta tag content?

 

John Mitchell
Posts:2779


01/11/2008 7:46 PM  

Ok, this is a real stumper. I like puzzles, so I spent some time trying to figure this one out. After a while of not really getting anywhere I decided I would cheat and use Google. That also didn't help much, but I did find out a lot more about regex and why you can't do this more directly. 

Anyway, I went back and tried a different approach that should allow you to get up to four occurances.

SearchFor:


(.*?<body.*?)(BOLD ME)(.*?)(BOLD ME)?(.*?)(BOLD ME)?(.*?)(BOLD ME)?(.*)

ReplaceWith:


  $1<b>$2</b>$3<b>$4</b>$5<b>$6</b>$7<b>$8</b>$9

If there is not 4 occurances, then you will have some empty tags, but they won't show. If you are doing something other than bolding then you may need another rule that follows to clean up the blank ones. I'll look into making a function for the searchFor block that allows you to capture a sub-group of the whole page first, and then do the replacements.
John Mitchell
Posts:2779


01/11/2008 8:04 PM  

I just did some more testing and that one I posted above doesn't quite work either. If it doesn't have the ? after the (BOLD ME) then it will only work if you have at least 4, but with the question marks it misses the last two if you have 4.

Back to the drawing board I guess.

I think If I create a Replace function that you can use in the Replace With field then you could capture a group in the Search for Field, then do a different Replace only in that group.

Maybe the one above will give you some ideas while I try to come up with a solution for this.

John Mitchell
Posts:2779


01/12/2008 5:53 AM  

I got it!

Search For:



(>[^<]*)(BOLD ME)([^<]*<(?!/title>))

Replace With:



$1<b>$2</b>$3

What it does is only grab BOLD ME that is in between > and <, but not if the < represents the start of the closing Title tag.

Please Register to post a reply. Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.
Forums >Snapsis Product Support >PageBlaster > PB Updates Meta content... how to disable??



ActiveForums 3.7
Powered by: Snapsis Software