1. KleanBox
  2. Guides

Filter SMS by keyword or regex on iPhone

Last updated: · KleanBox

Short answer

iPhone has no built-in way to filter texts by keyword; iOS only blocks numbers and screens unknown senders. To filter by a word, phrase or regular expression you need an SMS filter app selected in Settings. In KleanBox, which is free, you add a rule with Rules › Add Rule, choose Word or Regex, and pick whether it looks at the message, the sender or both. Matching texts from senders who are not in your contacts go to Junk, Promotions or Transactions instead of the inbox.

What iOS does on its own

NeedBuilt into iOSSMS filter app
Block one numberYesNot needed
Separate senders who are not in contactsYesNot needed
Filter texts containing a word or phraseNoYes
Filter by sender nameNoYes
Filter with a regular expressionNoYes

Add a keyword rule

  1. Install KleanBox and turn it on as the filter (setup guide).
  2. In the Rules tab tap Add Rule.
  3. Choose Word and type the phrase, for example free spins. Separate several words with commas to create one rule for each.
  4. Under Advanced, pick the Category (Spam, Promotions, Transactions) and the Match Field (Message Content, Message Sender, Both). By default the rule looks in the message and sends matches to Spam.
  5. Tap Save. The rule applies from the next message on; older messages are not reclassified.

Keyword matching ignores case and accents, and treats the Turkish dotted and dotless i as the same letter, so indirim also matches “INDIRIM” and “İNDİRİM”.

No pattern writing: Guided mode

If you would rather not write a pattern, choose Guided and describe the rule; KleanBox builds the expression:

Regex examples

RegexCatches
\d+\s*(freespin|free spin|fs)\bNumbered free-spin offers: “100 free spin”, “250 FS”
%\s*\d{2,3}\s*bonus“%100 bonus”, “% 50 bonus”
\bwin\s+(up\s+to\s+)?[$£€]\s*\d+“Win $500”, “win up to £1000”
https?://\S+\.(xyz|top|click)\bLinks on particular top-level domains

Regular expressions are matched without regard to case. An invalid expression cannot be saved, and Rule Health flags a rule that would also catch ordinary messages.

Test before you trust it

Paste a real message into the Test tab. KleanBox shows which folder it would land in and which rule or keyword decided, so you find a rule that would swallow bank or delivery texts before a real one arrives. Add senders that must never be filtered to Safe Senders; they are checked before every rule.

Limits set by iOS

Frequently asked questions

Can I block texts by keyword on iPhone without an app?

No. The built-in options are blocking a number and screening unknown senders. Keyword filtering needs an SMS filter app.

Is there a free iPhone app to filter SMS by keyword or regex?

Yes. KleanBox is free and supports keyword rules, regular expressions and a guided rule builder, with no limit on the number of rules, no subscription and no ads.

Which regex flavour is used?

Apple's NSRegularExpression (ICU syntax), matched case-insensitively against the message text, the sender, or both.

Can I share my rules with someone else?

Yes. Export your rules as a file; whoever opens it in KleanBox can add them with one tap.

Sources