-
Notifications
You must be signed in to change notification settings - Fork 45
Filter rules
Incoming messages are processed using these rules:
- If the
Enable NekoSMS
option is disabled, allow it. - If the
Whitelist contacts
option is enabled and it is from a contact, allow it. - If it matches a whitelist rule, allow it.
- If it matches a blacklist rule, block it.
- Otherwise, allow it.
There are no exceptions. You cannot give a blacklist rule a higher priority than a whitelist rule.
Rules can match against the message sender, body, or both. If you enter a pattern in both the sender and body tabs, the message will only be matched if both patterns match the corresponding field.
Note that the sender field can be a bit weird. In your SMS app, it probably displays as (123)-456-7890
or some other format. However, NekoSMS only sees the unformatted sender number. For most senders, it either looks like +11234567890
or 10086
. Many SMS apps display this in a "message details" page, which you can find by long-pressing on the message in your inbox.
Examples:
-
Sender contains 1234
-> Sender contains 1234, body can be anything -
Body contains hello
-> Sender can be anything, body contains hello -
Sender contains 1234; Body contains hello
-> Sender contains 1234 and body contains hello
Currently, NekoSMS supports these matching modes:
- Regular expression
- Wildcard
- Text contains
- Text starts with
- Text ends with
- Text equals
Regular expressions are matched in find mode - that is, they will match any substring in the text. For example, a pattern of ABCD
will match ABCD
, ABCDEFG
, and 12ABCD34
. If you only want to match ABCD
, surround your pattern with ^
and $
. See this link for more information.
When using Unicode escape sequences, make sure to match against the NFC-normalized form. For example, if you want to match the text はづき
, your pattern must either be はづき
or \u306F\u3065\u304D
(は+づ+き
), NOT \u306F\u3064\u3099\u304D
(は+つ+◌゙ +き
). If you are not using Unicode escape sequences in your regex patterns, you can safely ignore this.
Wildcards are essentially a watered-down version of regular expressions. There are 2 special characters in wildcard mode: *
, which will match 0 or more characters, and ?
, which will match exactly 1 character. Unlike regular expressions, wildcard matching is done in match mode - that is, a pattern of ABCD
will only match ABCD
. To match any text with ABCD
in the middle, surround the pattern with *
s. There are no escape characters in wildcard mode; for more control, use a regex instead.
Examples:
-
H?llo
matchesHello
,Hullo
,Hallo
, etc. -
Po*
matchesPo
,Potato
,Poi
,Poiiiiii
,PoiPoiPoi
, etc. -
*
matches literally everything
These are pretty self-explanatory. You can interpret them like wildcards:
- Contains
ABCD
= Wildcard*ABCD*
- Starts with
ABCD
= WildcardABCD*
- Ends with
ABCD
= Wildcard*ABCD
- Equals
ABCD
= WildcardABCD