Logical OR (Alternation) operation (a|b)
What is a logical OR operation? How to specify a logical OR operation in a regular expression?
How to use logical OR operations to build a regular expression to search and count common spamming terms from this email paragraph: I am inviting you for a business deal where this money will be shared between of us in the ratio of 60/40 percentage. Am assured you that within (7) seven banking working days, this said amount will enter your given Bank account with immediate alacrity. If you agree to my business proposal, further details of the transfer will be forwarded to you as soon as I receive your wiliness to join hand with me."
A logical OR operation, also called alternation, enables us to choose from one of several possible patterns. Character '|' is used as the logical OR operator.
Here are some examples of logical OR operations:
color|colour # matches "color" or "colour" Mon|Tue|Wed|Thu|Fri # matches "Mon", "Tue", "Wed", "Thu" or "Fri"
The regular expression to capture some common spamming terms is:
(business deal|bank account|business proposal) business deal - spamming term | - logical OR operator bank account - spamming term | - logical OR operator business proposal - spamming term
2013-01-22, 0👍, 0💬
All credit card numbers issued by Diners Club must start with 300 through 305, 36 or 38 and have 14 ...
How to write a regular expression to parse key-value entries from Windows .INI files? Here is an exa...
How to capture the Sogou web spider entries from Web log file? Here are some Web log file entries: 1...
How to capture the Baidu spider entries from Web log file? Here are some Web log file entries: 127.0...
Are you having problems using regular expressions when processing text strings in your applications ...