Post Reply 
Problems with simple text replacement
Jun. 09, 2004, 07:51 PM
Post: #1
 
I was having problems with an error message ("undefined not found") in the OzGrid Forums (for Excel/VBA help), but they changed their bulletin board software (now they're using vBulletin ... much better), so that problem (see Problem with "undefined not found" error in OzGrid) was fixed.

However, now many messages have bogus character entities (escape sequences), probably as a result of conversion to the new bulletin board, which I would like to clean up.

I figured that Proxomitron could do this for me. I have previously posted this request for help on the Computer Cops Forum -> JD5000 - Proxo because I use the JD 5000 Basic filter set, which could be interfering with what I want to do (I don't think so, but I can't tell). However, I have not yet received a response. I am reposting this request here in the hopes that somebody more knowledgeable can help me. Hail

Anyway, the problem seems to be some additional character entity text ("&") that is present in many of the posts. Here is the new rule that I wrote to try and fix it:
Code:
Name = "OzGrid:  Fix Amps & Quotes"
Active = TRUE
Multi = TRUE
URL = "*/www.ozgrid.com/forum/showthread.php*"
Bounds = "<td class="alt1"*</td>"
Limit = 20000
Match = "\1\&\2;\3"
Replace = "\1&\2;\3"
I tested both the URL matching and the rule matching with the Proxomitron tester, and it seemed to work okay (I got a match on the URL and the test HTML I used, copied from a real OzGrid message source, was modified as expected). However, when I save and apply the rule, it does not seem to have any affect. In fact, showing the "HTML Debug info" shows no trace of my rule being used.

Here is a URL to a thread on that forum that I was testing with:
Mathematical Calculations in User Forms [SOLVED]

I thought maybe one of the JD5000 filters might be consuming the text I wanted to modify before my rule could get at it, so I moved my rule to the top of the list, but it did not change the result.

Can somebody tell me what I am doing wrong ... please? Sad

TIA B)
Add Thank You Quote this message in a reply
Jun. 09, 2004, 10:48 PM
Post: #2
 
You need to remove the "*/" at the beginning of the URL for it to match
on your site.
Add Thank You Quote this message in a reply
Jun. 10, 2004, 07:01 AM
Post: #3
 
Hey, pooms! Thanks! Rocker

I added that because when I tested with the URL tester (right-click in URL Match textbox), it didn't match:

http://www.ozgrid.com/forum/showthread.php...t=ControlSource

until I added the "*/" prefix. But I guess you're telling me that the URL match is against whatever is after the "http://" (or whatever protocol it is). I had not picked up on that yet, and I missed it in the Proxomitron tutorial. So, thanks!

Okay, so now it is matching the URL and applying my rule, and it fixes the bad ampersand character entities, but it doesn't fix the bad quote character entities. In other words, the source text "&amp;" is translated to "&" which then displays as a single ampersand, which is great. However, the source text "&quot;" is NOT translated to """ which should display as a single quote, which is not so great.

Here is a bit of the source HTML that I am supposed to be altering (from the URL discussed previously):
Code:
    </td>
    <td class="alt1">
  <!-- message -->
  <div>I'm new to using User Forms, and find simple calculations in the Form
are not easy. I think these points have been covered before, but I can't find
them again. <br />
The scenario: I'm using a multi page form to complete various ratio analysis
on Financial statements (Balance Sheet, R &amp; E, etc.) My questions:<br />
1) I have a text box (locked) that totals all assets and I would like this to update
&quot;on the fly&quot;. I've tried linking to a formula in a
worksheet, but this works for only the first calculation. I've also tried writing
code, but don't know where to place the code so that it will run any time the
user places input in any of the cells that are to be totalled. Also, is there an
easier way?<br />
2) Is it possible to format text boxes with currency formatting?<br />
3) I would like to do some sophisticated calculations in the form(s), but I would
like the ability to do this as simple as you can in Excel Worksheets. Is this pie
in the sky dreaming on my part?<br />
4) Can anybody suggest a good book where I can further my knowledge, specifically
in the area of User Forms?<br />
Thanks for any help you can provide. I'm about ready to pack this programming
stuff and get a mundane, boring 9 to fiver where I don't have to deal with bits
and bytes anymore.<br />
<img src="images/smilie/flaming.gif" border="0" alt="" title="Flaming" class="inlineimg" />
Ted.................</div>
  <!-- / message -->
    </td>
</tr>
<tr>
    <td class="alt2">

It seems to me that I have my Match and Replace strings coded right to catch any character entity miscoded in this manner (note less-than and greater-than entities later on), but apparently not. What's wrong with it? [wacko]

Actually, I just looked a little closer and it seems that it matches/fixes the first miscoded character entity, of any kind, in each message, but then it skips the others. I thought that checking the "Allow for multiple matches" box would allow it to reprocess the source and catch all occurrences. Again, apparently not (did I mention that this is my first rule from scratch? [rolleyes] ).

Thanks again!
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: