please help really easy regex? RSS Back to forum
@Bryon:
also, as a follow up since i'm learning regex examples, how could i best match a subject which is only a date in thie format:
1/17/2015 3:04:07 PM
"one or two digits 1-12,
followed by a /,
followed by one or two digits 1-31,
followed by a /,
followed by a 4 digit number,
followed by a space,
followed by one or two digits 00-23,
followed by a :,
followed by a 2 digit number 00-59,
followed by a :,
followed by a 2 digit number 00-59,
followed by a space,
followed by AM or PM"
@Bryon:
Try
^from(\s[^\s\r\n]*){2}$
That is
beginning of string + "from" + (whitespace, followed by any character which is not whitespace or line break, any number of repetitions) twice + end of string
@Bryon:
Try
^(\d{1,2}/){2}\d{4}\s\d{1,2}:\d{2}:\d{2}\s(A|P)M$
It does not limit the double-digits though (that would be very complex/overkill imho).
@Krisztián Fekete (Vamsoft):
Hello
I'm trying to put this into practice and while this pattern would work in ORF, it would only match our keyword blacklist (subject) and act with that one set action
I'd like to be a little more clear to the senders, and to do that i'd put it in as a hub transport rule in Exchange - after ORF passes it.
Exchange doesn't like that regex (^from(\s[^\s\r\n]*){2}$) - it complains about the backslash being used in a way it doesn't understand
I know you're not here to support exchange, but because you are the regex expert, i was hoping you might be able to redefine that in a more "dumb" way so this inferior exchange filter can understand it? :)
@Bryon:
ORF uses the PCRE engine for regular expressions. Judging from the documentation of Exchange, its regex capabilities are very limited:
https://technet.microsoft.com/en-us/library/aa997187(v=exchg.141).aspx
Try the following alternatives:
^from\s(\w\w*)\s(\w\w*)$
^\d\d*/\d\d*/\d\d\d\d\s\d\d*:\d\d*:\d\d*\s(A|P)M$
I would like to match a subject which "starts with the word from, followed by one space, followed by a word, followed by one space, followed by another word, and that's all"
i'm missing something, i've tried:
^from.*[a-zA-Z][a-zA-Z]$
^from.*[ba-zA-Z\b].*[ba-zA-Z\b]$
^from.*[ba-zA-Z\b]\s[ba-zA-Z\b]$
any many, many variations...they all seem to match:
from oneword
from one word
from one word and others
thanks in advance!