What is Regex?
Regex lets you define search patterns that match a wide range of text combinations. This is especially helpful when scammers use unpredictable variations of names or keywords.Want to test your regex? Visit Rustexp — it uses the same Rust regex engine that Discord uses under the hood, so your results will be accurate.
You can also use regex101.com for general testing and its reference guide, but note that Discord may handle some patterns differently.
You can also use regex101.com for general testing and its reference guide, but note that Discord may handle some patterns differently.
Basic Example
/name-filters add regex ^Pascal$
This matches only the exact word Pascal.
^= start of the namePascal= exact characters$= end of the name
PascalIt will not match:
Pascal_, SirPascal, or pascal
Case-Insensitive Example
To make a regex case-insensitive, use(?i) at the beginning:
/name-filters add regex (?i)^Pascal$
This will match:
pascalPascalPASCALpAsCaL
Pascallthis is pascal0xPascal
Recommended Filter Example
/name-filters add regex (?i) bot$
This filter targets any username ending in a space followed by “bot” — a common impersonation tactic.
It will match:
OpenSea BOTAB botDoodles Best Bot
bottombest botsbot(without a space in front)
Note: There is an intentional space in the filter:
(?i) bot$Quick Reference
| Syntax | Meaning | Example |
|---|---|---|
. | Any single character | sc.m matches scam, sc@m, sc1m |
* | Zero or more of the previous | bo*t matches bt, bot, boot |
+ | One or more of the previous | bo+t matches bot, boot but not bt |
? | Zero or one of the previous | colou?r matches color and colour |
[abc] | Any character in the set | [a@4]dmin matches admin, @dmin, 4dmin |
[^abc] | Any character NOT in the set | [^a-z]bot matches 1bot but not abot |
^ | Start of the name | ^admin matches admin_123 but not notadmin |
$ | End of the name | bot$ matches scambot but not bottled |
(a|b) | Either a or b | (support|help) matches both |
(?i) | Case-insensitive mode | (?i)admin matches ADMIN, Admin, etc. |
\ | Escape a special character | \.com matches literal .com (not “Xcom”) |
Common Filter Patterns
| Goal | Pattern | Matches |
|---|---|---|
| Names ending in “bot” | (?i) bot$ | OpenSea BOT, AB bot |
| Names starting with “admin” | (?i)^admin | Admin_NFT, administrator |
| Catch ”@” substitution | (?i)[a@]dmin | admin, @dmin |
| Block leet speak | (?i)supp[o0]rt | support, supp0rt |
| Exact name only | ^Pascal$ | Pascal (nothing else) |
Limitations
Hashbot uses the Rust regex engine (same as Discord). A few things are not supported:- Lookahead/lookbehind —
(?=...),(?!...),(?<=...),(?<!...)will not work - Backreferences —
\1,\2etc. are not available - Possessive quantifiers —
*+,++are not supported
Caution & Best Practices
- Always test your regex on Rustexp before adding it (uses the same Rust regex engine as Discord)
- Run
/cleanseafter adding a new filter — results are displayed with a “Review on Dashboard” button at dashboard.hashbot.com - Avoid overly broad patterns like
.+or.*— they match nearly everything - If you accidentally create an overly broad filter:
- Use
/settings pause pause-state:pauseto stop Hashbot from acting - Remove the problematic filter
- Use
/settings pause pause-state:unpauseto resume normal operation - Cancel any pending
/cleansejobs if needed
- Use
Need Help?
Regex can be tricky. If you’re not confident, join our Support Discord and open a ticket.We’re happy to help build or review filters with you.