nfilter users

Page 2 of 2  
snipped-for-privacy@host122.r-bonomi.com (Robert Bonomi) wrote: [snip]

Elegant.
Just curious, Robert ... how do the efficiencies of these two expressions compare?
[Yy][^A-XZa-xz]* [Yy]+[^A-Za-z]*
-- Regards, Doug Miller
For a copy of my TrollFilter for NewsProxy/Nfilter, email me at filterinfo-at-milmac-dot-com
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Doug Miller wrote...

These aren't equivalent expressions, so an efficiency comparison doesn't seem pertinent.
Jim
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

I realize they're not equivalent, but for the purposes to which we're putting them, they might as well be.
-- Regards, Doug Miller
For a copy of my TrollFilter for NewsProxy/Nfilter, email me at filterinfo-at-milmac-dot-com
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

The first one is noticeably faster, although not grossly so.
In the first case, the '[Yy]' drops out of consideration as soon as a 'y' is encountered. Only a 'set membership' test is required on the subsequent characters.
In the second instance, after the initial 'y' is encountered, a subsequent character _could_ be (1) a continuation of the 1st token (another 'y'), or it could be (2) the initial part of the next token ("not a letter"), or it could (3) be a 'not match'. You _have_ to make *both* tests (1) and (2) on each character following every 'y' -- because there could be 'something else' following the "not a letter" test that would invalidate one presumption but not the other
Contemplate something (nonsensical!) like the regex "[Yy]+[yY]+" and the string "xxYYYyyzz".
Yes, the regex _does_ generate a match on that string -- starting at the character immediately after the 2nd 'x'.
Now the mighty question rises, _which_ of the characters between the 'x' and 'z' match with *which* of the two tokens in the regex?
The first one clearly matches the first "[]+" token,
And since we _do_ have a match (you can trust me on that :), one of the four subsequent letters must match the 2nd "[]+" token. But _which_ one? <evil grin>
The "internal processing" of regular expression match checking is *MESSY*!! And a hell of a lot more complicated than it initially appears.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
snipped-for-privacy@host122.r-bonomi.com (Robert Bonomi) wrote:

Thanks. [snip explanation]

I'm gonna guess that it's the second lower-case y, as the character immediately following that is not a match.
Is there a prize if I'm right?
-- Regards, Doug Miller
For a copy of my TrollFilter for NewsProxy/Nfilter, email me at filterinfo-at-milmac-dot-com
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yes, the overall match covers all the 'y' characters, regardless of case. The question I meant to pose is "which token matches _which_ characters?"
Is it a one-character match for the first token, and four for the second, or two and three, or three and two, or four and one?
For extra credit, _when_ is that determination made, and on what basis?

If you're into musical instruments, I've got a spare set of hardware for an air guitar I could liberate. You'll have to pick up the shipping charges though.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I've updated the filter rules at: <http://www.r-bonomi.com/rec.woodworking
They're broken out into several separate files, for: hosts/domains/IP-addresses the troll posts from inappropriate and/or excessive cross-posting vulgarities politics
Simply download the rule-sets you want to use, append together to create a single file, and install.
Note: The main web-page now shows the date/time that each filter set was last modified.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Site Timeline

Related Threads

    HomeOwnersHub.com is a website for homeowners and building and maintenance pros. It is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.