Like trusted sender, can I create a trusted receiver ?

Use this forum to get help.

Postby josh » Fri May 13, 2005 11:17 pm

I had to write code for that -- it's lame though, just in the HTML. I hate to modify the phpbb code because we upgrade so frequently
josh
 
Posts: 1371
Joined: Fri Aug 29, 2003 2:28 pm

Postby Guest » Sat May 14, 2005 4:46 am

lwc wrote:[............]
So now you can understand that "(.*)" or "(.+)" means that everything can be repeated.
In the case of "list(.*)", it would work for list@ (well, only in the former case), list-bla@, list-whatever@, listing@, etc.

This all belongs to a sub-language (with the lack of a better term) called "regional expressions" (aka regexp) that is a part of all the major programming languages (Javascript, CGI, PHP, etc.).


Great Explanation

thanks and regards
Guest
 

Postby crazycomputers » Sat May 28, 2005 7:10 pm

lwc wrote:This isn't DOS.
The wildcard is actually the only part you haven't mentioned - the dot (".").
. is like the * from DOS (i.e. everything or nothing).
Well, sort of. Because in DOS * is enough and here the wildcard is accompanied by * or +, which signal how many times can something (in the case of ".", make it everything) be repeated.

* means whatever is inside (here*) can be repeated 0 or more times. So "here" would work. So would "herehere" and "herehereherehereherehere".

There's also +, which means 1 or more times (not 0). So (here+) means that "herehere" would work and so would "herehereherehere", but not just "here" alone.
In other words, there must be at least one repetition!

() just means which part can be repeated. It signals which letters you refer to. After all, without it, how would it know whether allofthis.* should be repeated or just the word "this", in which case it'd be allof(this*), get it?

So now you can understand that "(.*)" or "(.+)" means that everything can be repeated.
In the case of "list(.*)", it would work for list@ (well, only in the former case), list-bla@, list-whatever@, listing@, etc.

This all belongs to a sub-language (with the lack of a better term) called "regional expressions" (aka regexp) that is a part of all the major programming languages (Javascript, CGI, PHP, etc.).


Sorry to burst your bubble, but most of what you said is not correct. * means that the previous token should be repeated 0 or more times. In this case, that means that "here" would match, as well as "herehere", but "" would match too.

+ means 1 or more. It would match "here", which you said it wouldn't. But it would not match "".

And regexp is actually "regular expressions" not "regional expressions." (Yep, they exist all over the globe!)

Furthermore, (here*) would not do what you expect. The quantifiers (*, +, {n,m}, etc) match the smallest previous token. In this case, it's like saying (her(e*)). You would match "her", "here", and "hereeeeeeeee". If you really want 0 or more of "here", then you should do (here)*.

I'm not trying to be nitpicky, but while these are some small errors, they can be very annoying when tracking down -- especially if you're deleting email from your boss with an incorrectly-written exclusive sender.
Real programmers don't comment their code. It was hard to write; it should be hard to understand.
crazycomputers
 
Posts: 31
Joined: Sat Dec 18, 2004 7:53 pm

Postby lwc » Thu Jun 02, 2005 5:57 pm

I stand corrected. Thanks for the fixes. I've fixed them for future reference (so people who look it up in the future wouldn't have errors in their codes).

My biggest problem was that I was certain "*" & "+" signal repetitions and not mentions. From now on I shall only use the word "mentions"...

But as for * (0 or more), what's the difference between "foobar." and "foobar.*" ?
After all, isn't the default of "." 0 or more mentions of "everything"?
In other words, why using "(.*)" and not just "."?
lwc
 
Posts: 455
Joined: Sat Aug 28, 2004 9:09 am

Postby SysKoll » Fri Jun 03, 2005 1:40 am

A dot in a regexp means "any character". A .* means 0 or more ".", that is, 0 or more anything.

"foobar" will match all exclusive senders containing foobar, so "foobar.*" is unnecessary.

This is not an exact match (ABCfoobar123 is not an exact match for foobar, that would be .*foobar.*), but foobar is contained in ABCfoobar123, which is what the exclusive sender comparison looks at.
-- SysKoll
SysKoll
 
Posts: 893
Joined: Thu Aug 28, 2003 9:24 pm

Postby lwc » Fri Jun 03, 2005 9:38 am

No, I meant what if I want to capture foobar-whatever (whatever can be everything)?

What's the difference then between using "foobar." and "foobar.*"?

Also, does "." alone mean something must be captured [i.e. "foobar" alone will not be captured - as if I used "foobar(.+)]?
lwc
 
Posts: 455
Joined: Sat Aug 28, 2004 9:09 am

Postby SysKoll » Fri Jun 03, 2005 10:58 am

What's the difference then between using "foobar." and "foobar.*"?


Again, "foobar." means "foobar" followed by any one char (the dot). "foobar.*" means foobar followed by 0 or more repetitions of the symbol before the *, which is dot (standing for any char).

As far as exclusive senders are concerned, there is no difference between these.
-- SysKoll
SysKoll
 
Posts: 893
Joined: Thu Aug 28, 2003 9:24 pm

Postby crazycomputers » Tue Jun 14, 2005 12:04 am

lwc wrote:What's the difference then between using "foobar." and "foobar.*"?

Also, does "." alone mean something must be captured [i.e. "foobar" alone will not be captured - as if I used "foobar(.+)]?

I know others have replied, but I want to show some examples to clarify this further.

The dot metacharacter means exactly one character. If it's followed by a quantifier, those will of course take effect. So foobar. will match foobars but it will NOT match foobar, because it's expecting one more character -- even though it doesn't care what it is. foobar.* means "foobar followed by zero or more of anything." But in this context, .* is useless, since there is no anchor on the end of a line -- in other words, the regexp foobar is functionally equivalent to ^.*foobar.*$. Sorta. For this match it will be the same, but if you're capturing data then you need to worry about the greediness of the * quantifier.

More precisely, foobar is equivalent to ^.*?foobar.*$ -- the ? after the * makes the * "non-greedy;" it will match as few times as it possibly can. But if you don't consider yourself a geek, you probably will never need to know that.

In summary, just foobar is a lot faster, and I think josh would be happier if you didn't surround your regexps with a pair of .*s.
Real programmers don't comment their code. It was hard to write; it should be hard to understand.
crazycomputers
 
Posts: 31
Joined: Sat Dec 18, 2004 7:53 pm

Postby LeLaid » Mon Sep 19, 2005 9:58 am

All this is very interresting. One question more:

Will the following work?
Code: Select all
(.*)@domain1.com | (.*)@domain2.com


P.
LeLaid
 
Posts: 1
Joined: Mon Sep 19, 2005 9:40 am

Postby josh » Mon Sep 19, 2005 4:02 pm

That'll probably work, except for the spaces around the pipe symbol. A better way would probably be:

domain1.com|domain2.com
josh
 
Posts: 1371
Joined: Fri Aug 29, 2003 2:28 pm

Postby angus » Sat Oct 01, 2005 5:44 pm

gee, i see that the exclusive sender matches on the *recipient*... that explains why this does not work:

one of my (secondary) "real" mail accounts is foo@bar.com
i forward it to a spamgourmet address say bar.myid@spamgourmet.com

i would like to receive all mail sent to foo@bar.com from the domain bar.com, but nothing else. so i set the count to 0 and exclusive sender to bar.com. this does not have the desired effect; because the to:foo@bar.com contains bar.com, *everything* will get forwarded.

is there any way to really only match on the *sender* ?

it really seems like this setting has been overloaded too much. the meaning of To: and From: should really be separate. e.g. spam is often sent to user1@bar.com, user2@bar.com, foo@bar.com, ... so even specifying a regexp of (to paraphrase) "not foo" @ bar.com will not help. and setting a global trusted sender weakens the filtering on the other addresses.
angus
 
Posts: 1
Joined: Sat Oct 01, 2005 5:24 pm

Previous

Return to Support / Hilfe / ayuda / ondersteuning / ...

Who is online

Users browsing this forum: No registered users and 25 guests

cron