I am trying to add a new transportation rule to an Exchange 2016 server. The rule should effect all mails with the following character set in the title: |&|
I used 'If the title contains one of the following words' and added the string |&| there . Unfortunately it does not work. When I use only & the rule works.
Should I use maybe \ or " like in some programming languages? All I tried did work work.
Thank you!
Solved! One have to use the pattern matching, not the string matching and escape the | with \. The resulting expression is ^(\|&\|)
Related
I'm trying to match any recipients with the address hello-546#mydomain.com or test-653#mydomain.com to a new rules in exchange online. The important thing it to match email that ends with a - followed by 3 digits. I tried to add the pattern \S*[-]\d\d\d\#mydomain\.com but im always getting the error The patterns you specified contains prohibited leading or trailing regex characters. Not sure which regex characters, as I know that the \S is supported.
Any help would be appreciated.
okay, so the correct pattern is [-]\d\d\d\#mydomain\.com$
I would like to add a rule that blocks all incoming e-mails that contain a certain expression. Ex: 'Test Phrase'. I have added the line
rawbody NO_SPAMW /Test" *"Phrase/i
but it seems it doesn't work. Can you tell me what is the correct way to parse a space to spamassassin?
Thank you!
You can match a space with \s.
rawbody TEST_PHRASE /test\s*phrase/i
score TEST_PHRASE 0.1
describe TEST_PHRASE This is a test
More about writing custom rules here
I have regular expression like this:
regularExp = "^[-]{0,1}([0-9]|[a-z]|[A-Z]|[\s]){0," & decNum & "}\.$"
Here I need to add all Special Character's, like ~!##$%^&*()_+{}|:"<>?[]\;',./ in VB6.0
I guess you are looking for something like POSIX bracket extensions and a special character class which matches all punctuation characters without listing them explicitly.
Unfortunately you are out of luck, since the Regular Expressions available in Visual Basic 6 are provided by the same VBScript RegExp engine which was available in IE 5.5. That engine was not updated in 15 years, so many features are missing.
Having said that, your only option is to "handpick" each and every character you want to match and put them in a character class, like this
[~!##$%^&*()_+{}|:"<>?[\]\\;',./]
Fortunately you don't have to escape all special characters within character classes, only the ones which confuse the parser. (Namely \, ^, - and ])
you can use
^[a-zA-Z._^%$#!~#,-] as referance and add more special characters which you want to allow.
You can use add special characters as below
[^%$#!~#()*\s]
While reading Engineering long-lasting software: an Agile approach using SaaS and cloud computing I came across the following regex (Chapter 5, Section 5.3 Introducing Cucumber and Capybara):
/^(?:|I )am on (.+)$/
I know about the non-capturing (?: ...) syntax, but what I don’t understand is the meaning of the first pipe character after the colon. Is it a typo? Does it serve any particular purpose?
The pipe in regex means alternative. In this case, it is expressing alternation between an empty string "" and the string "I ".
It is just the or. It can match either nothing or I (with a space). The rest is non-capturing group like you mention.
The regex matches something like I am on a diet and also am on a diet and in the above examples, captures a diet in the first group.
Try it out on Rubular - http://rubular.com/r/q3RFEoxj1e
(?:|something)
("nothing / empty string or the match")
Is exactly the same thing as:
(?:something)?
("the match, once or none")
In other words: the non-capturing subpattern is optional.
I am trying to grasp the concept of Regular Expressions but seem to be missing something.
I want to ensure that someone enters a string that ends with .wav in a field. Should be a pretty simple Regular Expression.
I've tried this...
[RegularExpression(#"$.wav")]
but seem to be incorrect. Any help is appreciated. Thanks!
$ is the anchor for the end of the string, so $.wav doesn't make any sense. You can't have any characters after the end of the string. Also, . has a special meaning for regex (it just means 'any character') so you need to escape it.
Try writing
\.wav$
If that doesn't work, try
.*\.wav$
(It depends on if the RegularExpression attribute wants to match the whole string, or just a part of it. .* means 'any character, 0 or more times')
Another thing you should consider is what to do with extra whitespace in the field. Users have a terrible habit of adding extra white space in inputs - its why various .Trim() functions are so important. Here, RegularExpressionAttribute might be evaluated before you can trim the input, so you might want to write this:
.*\.wav[\s]*$
The [\s]* section means 'any whitespace character (tabs, space, linebreak, etc) 0 or more times'.
You should read a tutorial on regex. It's not so hard to understand for simple problems like this. When I was learning I found this site pretty handy: http://www.regular-expressions.info/