Regular expressions with "AND" and "OR"
On this page you will find detailed information on the connection of regular expressions with "AND" and "OR" operators. With regular expressions you can define conditions for routing. Read more about this solution on this page.
So with regular expressions you can define match patterns as conditions for message routing. These patterns can be connected with logical "OR" or "AND". If the pattern is matched then the message will be sent out to the destination on the defined route. Please check our examples on this page.
For example, a regular expression is provided as a condition to the recipient telephone numbers beginning with "310" or "311" in the following way:
If you enter /^(310|311).*/ in the Condition 2 line, then if the phone number of the recipient matches the directives of this condition; so if the phone number of the recipient starts with "310" or "311" (and "310" or "311" can be followed by any digit) the outgoing SMS messages will be sent out using the SMPP connection. In this way, this rule will be met in case of phone numbers: "3101234" and "3112345" but it is not matched in case of "06303101234" phone number.
If you use international telephone number format (starts with "+"), you can use the following regular expression: /^[+]*(310|311).*/
Among regular expressions, by default there is an "AND" connection. Therefore, the provided values are connected by "AND" connection. If you provide a regular expression as a condition, there will be an "AND" connection among its elements. For example, if the text of the outgoing message starts with "John" and ends with "Smith", then messages will be sent out through the installed GSM modem. This condition will be matched both in case of the message of "John Smith" and "John Edward Smith". But if the text of the message is "Smith John" then this condition will not be met (Figure 2).
More information
- Inbound SMS Routing with multiple keywords
- SMS Load Balancing
- SQL SMS routing
- Inbound SMS Routing
- Sender address modification
- Least Cost SMS Routing
- Load Balancing
- Backup SMS Routing
- Send message to multiple recepient
- How to schedule an SMS message
- Convert local phone numbers into international ones