regex question - symbol for "and"

Forum for MailWasher Pro 7 and/or older 2011/2012 versions.
allangjohnson
Travelling Tuatara
Posts: 48
Joined: Fri Jul 09, 2010 9:15 am

regex question - symbol for "and"

Sun Aug 08, 2010 2:49 am

I know that a | is used for "or" in a regex expression as in yes|no but what is the symbol for "and"?

Thanks.
AJ
Last edited by allangjohnson on Sun Aug 08, 2010 2:53 am, edited 1 time in total.
User avatar
anniebrion
βeta Tester
Contact:
Location: Milkyway, Sol, Earth, UK, London
Posts: 3222
Joined: Thu Nov 05, 2009 10:39 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 2:52 am

Everything that is not an or (|) is an and.
Annie.......... PC details
Mailwasher Pro βeta [v 7.12.39]
allangjohnson
Travelling Tuatara
Posts: 48
Joined: Fri Jul 09, 2010 9:15 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 2:55 am

That was quick - thanks.

So, if I write

(.+@){10,} [email protected]

that would catch anything that was both sent to ten or more recipients AND was from [email protected]?

AJ
User avatar
anniebrion
βeta Tester
Contact:
Location: Milkyway, Sol, Earth, UK, London
Posts: 3222
Joined: Thu Nov 05, 2009 10:39 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 3:01 am

The from: test would go in a separate rule and set the rules to ALL instead of ANY.
Last edited by anniebrion on Sun Aug 08, 2010 3:09 am, edited 1 time in total.
Annie.......... PC details
Mailwasher Pro βeta [v 7.12.39]
allangjohnson
Travelling Tuatara
Posts: 48
Joined: Fri Jul 09, 2010 9:15 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 3:03 am

That's what I was hoping to avoid, because I wanted that filter to be one line in a multiline filter that would be tripped in ANY condition was satisfied.

AJ
User avatar
anniebrion
βeta Tester
Contact:
Location: Milkyway, Sol, Earth, UK, London
Posts: 3222
Joined: Thu Nov 05, 2009 10:39 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 3:11 am

It's difficult testing to: & from: in the same single rule as I have tried to do this in the past :(

The major issue is that email headers are not standardized enough, sometimes the to: comes before the from: other times it is the reverse, also sometimes a subject: is inbetween and sometimes not :(
Annie.......... PC details
Mailwasher Pro βeta [v 7.12.39]
allangjohnson
Travelling Tuatara
Posts: 48
Joined: Fri Jul 09, 2010 9:15 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 3:16 am

I understand. But am I correct that just putting a space between the two items makes it an "AND"?
So, using a different example, if the filter looks in the subject line for

hot cold

it would trip only if the subject line contained both words?

AJ
User avatar
anniebrion
βeta Tester
Contact:
Location: Milkyway, Sol, Earth, UK, London
Posts: 3222
Joined: Thu Nov 05, 2009 10:39 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 3:22 am

NO putting a space is not an AND.

The and is ie:

Code: Select all

.+@domain
"1 or more characters" AND @ AND domain

Code: Select all

(fred|bert)@domain
(fred OR fred) AND @ AND domain
Last edited by anniebrion on Sun Aug 08, 2010 3:31 am, edited 1 time in total.
Annie.......... PC details
Mailwasher Pro βeta [v 7.12.39]
allangjohnson
Travelling Tuatara
Posts: 48
Joined: Fri Jul 09, 2010 9:15 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 3:28 am

Sorry to be so slow, but why isn't

(fred|bert)@domain)

(fred OR fred) AND @ AND d AND o AND m AND a AND i AND n?

AJ
User avatar
anniebrion
βeta Tester
Contact:
Location: Milkyway, Sol, Earth, UK, London
Posts: 3222
Joined: Thu Nov 05, 2009 10:39 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 3:32 am

It is but I couldn't be bothered to do all the ANDs :devil and it looks tidier than:

"1 or more characters" AND @ AND d AND o AND m AND a AND i AND n

Or

((f AND r AND e AND d) OR (b AND e AND r AND t)) AND @ AND d AND o AND m AND a AND i AND n

The last one makes the AND and ORs harder to spot.
Annie.......... PC details
Mailwasher Pro βeta [v 7.12.39]
allangjohnson
Travelling Tuatara
Posts: 48
Joined: Fri Jul 09, 2010 9:15 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 4:11 am

So there isn't a way to have a single line that trips a filter if the subject line contains

hot AND cold

AJ
User avatar
anniebrion
βeta Tester
Contact:
Location: Milkyway, Sol, Earth, UK, London
Posts: 3222
Joined: Thu Nov 05, 2009 10:39 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 4:15 am

allangjohnson wrote:So there isn't a way to have a single line that trips a filter if the subject line contains

hot AND cold

AJ
Yes there is but they have to be in the right order or you will need 2 rules

Code: Select all

hot\x20.*cold

Code: Select all

cold\x20.*hot
.* = Zero or more characters
\x20 = Space
Last edited by anniebrion on Sun Aug 08, 2010 4:22 am, edited 2 times in total.
Annie.......... PC details
Mailwasher Pro βeta [v 7.12.39]
allangjohnson
Travelling Tuatara
Posts: 48
Joined: Fri Jul 09, 2010 9:15 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 4:18 am

or could it be in a single line as

hot.*cold|cold.*hot

?

AJ
User avatar
anniebrion
βeta Tester
Contact:
Location: Milkyway, Sol, Earth, UK, London
Posts: 3222
Joined: Thu Nov 05, 2009 10:39 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 4:21 am

allangjohnson wrote:or could it be in a single line as

hot.*cold|cold.*hot
Simplistically yes, but that would match subject = "Hotdogs and coldfish"

Mabye:

Code: Select all

hot(\x20|$).*cold(\x20|$)|cold(\x20|$).*hot(\x20|$)
But I'm sure you get the idea.
Last edited by anniebrion on Sun Aug 08, 2010 4:24 am, edited 1 time in total.
Annie.......... PC details
Mailwasher Pro βeta [v 7.12.39]
allangjohnson
Travelling Tuatara
Posts: 48
Joined: Fri Jul 09, 2010 9:15 am

Re: regex question - symbol for "and"

Sun Aug 08, 2010 4:24 am

I think I've got it. Thank you.

AJ

Return to “MailWasher Pro 7”