in reply to Re: Anchors, bleh :( (escape)
in thread Anchors, bleh :(

> MIME uses an idea that is kinda neat and could help here.
> [...]

Oh, that's very cute! I can think of a couple of ways of implementing it; in fact, if the data isn't too big, you could say something like this (untested, but the intent should be obvious):

$delim = '!@#$'; # Test for both the 'tag' and the '/tag' varsion $delim .= chr(rand(95) + 33) while $data =~ m{/?$delim}s;
> Your concern there appears to be one of speed of 
> execution. You might reconsider this concern (or at 
> least test it), as running the long mangling process 
> several times on short strings could certainly end up 
> not being much slower than running it once on the much 
> longer full string.

[blink] Yes. The latter was exactly what I was saying, so we're in violent agreement. :) That's why I'm trying to come up with code that will let me do that.

I actually ran a test even before posting here - I'm quite aware that "efficiency is the hobgoblin of little minds". The speed of execution, for what was admittedly a rather large mail archive, went from about two seconds (using a script without this routine) to several minutes (I killed it after about two and a half; no, it wasn't stuck in a loop.) Tagging, removing, processing (once), and replacing - less than three seconds.

Perhaps the way that I had written the new routine was at fault - I'm not sure - but I am sure that running my "mangling" routine more than once is quite expensive.