Skip to main content

Boolean Operators Explained

Overview of each operator that is available in Advanced Alerts

Camille Kasmi avatar
Written by Camille Kasmi
Updated this week

Using Advanced Alerts, you can build precise boolean queries to improve result quality and monitor specific topics. This article explains every operator, how they interact, and how to structure queries.

Table of Contents


AND , OR , AND NOT Operators

AND, OR, AND NOT are the core connectors for your search terms and other (non‑autonomous) operators. "AND" requires all linked terms; "OR" creates alternatives; "AND NOT" excludes terms/operators.

Note: Mention looks for exact spelling and spacing matches, excluding capitalization.

"AND" Operator Examples

Example 1 – AND Operator & Keyword Searches

Spotify AND "Apple Music" AND Pandora

Fetches posts where all three appear. If one is missing, it’s not fetched.

Example 2 – AND Operator & Boolean Operators

Spotify AND (source_country:(BR) AND lang:(pt))

Fetches posts where Spotify appears from Brazil, in Portuguese. If content is another language/country, it’s ignored.

"OR" Operator Examples

Example 1 – OR Operator & Keyword Searches

Spotify OR "Apple Music"

Fetches either term; two active searches inside one alert.

Example 2 – OR Operator & Boolean Operators

Spotify AND source_country:(US OR FR OR BR)

Fetches Spotify from the United States, France, or Brazil.

"AND NOT" Operator Examples

Example 1 – AND NOT Operator & Keyword Searches

Spotify AND NOT "Apple Music"

Fetches Spotify when Apple Music is not present.

Example 2 – AND NOT Operator & Boolean Operators

Spotify AND NOT source:twitter

Fetches Spotify from all sources except Twitter.


Proximity & NEAR Operators

Similar to the AND operator, the proximity operators allow you to link keywords in your search query with added precision. The proximity operators require your search terms to be within a certain range of each other. Below, you will find information for these operators:

Restrictions

⚙️ The proximity operator only works for your text searches. You cannot use it for data operators such as language, country, or source operators to name a few, nor with body operators (body and title).

❗ Does not work with Twitter Historical Data.

Syntax

The ~# operator works with search phrases and will apply a proximity limit to the phrase in your search. For this operator, you can replace the # with a number between 1 to 6. Depending on the number you choose, Mention will fetch the text in your phrase when they appear between 1 to 6 words of each other.

The NEAR/ operator is similar to the proximity operator except it used to link multiple keywords or phrases together. For this operator, you can replace the # with a number between 1 to 6 and Mention will search for content that fits your search configuration.

  • Proximity: ~# — attach to a phrase; # is 1–6.

  • NEAR/# — between two terms/phrases; # is 1–6.

Proximity: ~#

"NASA rover"~6

Matches when NASA and rover are within 6 words.

  • NASA rover...

  • NASA and it's new rover...

  • NASA just launched a rover to space...

NEAR/#

"NASA TV" NEAR/4 SpaceX

Matches when NASA TV and SpaceX appear within 4 words.

  • Watch SpaceX footage on NASA TV...

  • NASA TV will work with SpaceX on...

  • NASA TV and SpaceX collaborations...


Language Operator

Lang:

The lang: operator can be used to monitor or block specific languages. To use this operator, please add the lang: operator and the language codes to your query using AND or AND NOT.

Syntax

AND lang:(<code> [OR <code> ...]) AND NOT lang:(<code> [OR <code> ...])
  • Non‑autonomous: must be paired with a keyword search via AND/AND NOT.

  • If you want to monitor every language on the web, do not use the lang: operator to keep your search query as a broad search.

Examples

Monitor a language

Starbucks AND "Pumpkin Spice" AND lang:(en)

Monitor multiple languages

Starbucks AND "Pumpkin Spice" AND lang:(en OR fr OR es)

Block languages

Starbucks AND "Pumpkin Spice" AND NOT lang:(pt)

Language Code List

Mention can monitor any of the below languages.

  • af - Afrikaans

  • ar - Arabic

  • az - Azerbaijani

  • be - Belarusian

  • bg - Bulgarian

  • bn - Bengali

  • bs - Bosnian

  • ca - Catalan

  • cs - Czech

  • da - Danish

  • de - German

  • el - Greek

  • en - English

  • eo - Esperanto

  • es - Spanish

  • et - Estonian

  • fa - Persian

  • fi - Finnish

  • fil - Filipino

  • fr - French

  • gu - Gujarati

  • hi - Hindi

  • hr - Croatian

  • hu - Hungarian

  • hy - Armenian

  • is - Icelandic

  • it - Italian

  • iw - Hebrew

  • ja - Japanese

  • km - Khmer

  • kn - Kannada

  • ko - Korean

  • lt - Lithuanian

  • lv - Latvian

  • ml - Malayalam

  • mr - Marathi

  • ms - Malay

  • my - Burmese

  • nl - Dutch

  • no - Norwegian

  • pa - Punjabi

  • pl - Polish

  • ps - Pashto

  • pt - Portuguese

  • ro - Romanian

  • ru - Russian

  • si - Sinhala

  • sk - Slovak

  • sl - Slovenian

  • sr - Serbian

  • sv - Swedish

  • sw - Swahili

  • ta - Tamil

  • te - Telugu

  • th - Thai

  • tl - Tagalog

  • tr - Turkish

  • uk - Ukrainian

  • ur - Urdu

  • vi - Vietnamese

  • zh - Chinese

If you do not choose a language, Mention monitors all languages containing your keywords.

Twitter (X) does not process Swahili. Segment Swahili filtering outside the Twitter source if needed.


Source Country Operator

source_country:

Use this operator to fetch or block mentions by their specific country codes using website or account geolocation data. Mention can monitor any ISO 3166‑1 alpha‑2 code.

Syntax

AND source_country:(<CC> [OR <CC> ...]) AND NOT source_country:(<CC> [OR <CC> ...])

Scope & Source behavior

  • Works on: Web, News, Blogs, Forums, Facebook, Instagram, and Twitter/X.

  • Non‑autonomous: must be combined with a keyword search via AND/AND NOT.

  • Mention cannot bypass VPNs/fake locations supplied by sites or social accounts.

  • Some mentions lack country codes. See "has:source_country" below.

Examples

Monitor a country

"Krispy Kreme" AND coffee AND source_country:(FR)

Monitor multiple countries

"Krispy Kreme" AND coffee AND source_country:(FR OR US OR BR)

Block countries

"Krispy Kreme" AND coffee AND NOT source_country:(ES OR DE)

Most of our social media sources, and some do not always include a country code. If a website does not have a country code, you can still monitor it with the operator -has:source_country. Here is an example:

McDonalds AND "Big Mac" AND (source_country:(IT) OR -has:source_country)

Fetches Italy posts and posts with no geolocation data.

For more information, see Geolocation Monitoring Explained.

Country Code List

Use Ctrl/⌘+F to search.

Afghanistan — AF
Aland islands — AX
Albania — AL
Algeria — DZ
American Samoa — AS
Andorra — AD
Angola — AO
Anguilla — AI
Antarctica — AQ
Antigua and Barbuda — AG
Argentina — AR
Armenia — AM
Aruba — AW
Australia — AU
Austria — AT
Azerbaijan — AZ
Bahamas — BS
Bahrain — BH
Bangladesh — BD
Barbados — BB
Belarus — BY
Belgium — BE
Belize — BZ
Benin — BJ
Bermuda — BM
Bhutan — BT
Bolivia — BO
Bosnia & Herzegovina — BA
Botswana — BW
Bouvet Island — BV
Brazil — BR
British Indian Ocean territory — IO
Brunei — BN
Bulgaria — BG
Burkina Faso — BF
Burundi — BI
Cambodia — KH
Cameroon — CM
Canada — CA
Cape Verde — CV
Caribbean Netherlands — ****
Cayman Islands — KY
Central African Republic — CF
Chad — TD
Chile — CL
China — CN
Christmas Island — CX
Cocos (Keeling) Islands — CC
Colombia — CO
Comoros — KM
Congo - Brazzaville — CG
Congo - Kinshasa — CD
Cook Islands — CK
Costa Rica — CR
Côte d'Ivoire — CI
Croatia — HR
Cuba — CU
Curaçao — CW
Cyprus — CY
Czechia — CZ
Denmark — DK
Djibouti — DJ
Dominica — DM
Dominican Republic — DO
Ecuador — EC
Egypt — EG
El Salvador — SV
Equatorial Guinea — GQ
Eritrea — ER
Eswatini — SZ
Falkland Islands — FK
Faroe Islands — FO
Fiji — FJ
Finland — FI
France — FR
French Guinea — GF
French Polynesia — PF
French Southern Territories — TF
Gabon — GA
Gambia — GM
Georgia — GE
Germany — DE
Ghana — GH
Gibraltar — GI
Greece — GR
Greenland — GL
Grenada — GD
Guadalupe — GP
Guam — GU
Guatemala — GT
Guernsey — GG
Guinea — GN
Guinea - Bissau — GW
Guyana — GY
Haiti — HT
Heard & McDonald Islands — HM
Honduras — HN
Hong Kong SAR China — HK
Hungary — HU
Iceland — IS
India — IN
Indonesia — ID
Iran — IR
Iraq — IQ
Ireland — IE
Isle of Man — IM
Israel — IL
Italy — IT
Jamaica — JM
Japan — JP
Jersey — JE
Jordan — JO
Kazakhstan — KZ
Kenya — KE
Kiribati — KI
Kuwait — KW
Kyrgyzstan — KG
Laos — LA
Latvia — LV
Lebanon — LB
Lesotho — LS
Liberia — LR
Libya — LY
Liechtenstein — LI
Lithuania — LT
Macao SAR China — MO
Madagascar — MG
Malawi — MW
Malaysia — MY
Maldives — MV
Mali — ML
Malta — MT
Marshal islands — MH
Martinique — MQ
Mauritania — MR
Mauritius — MU
Mayotte — YT
Mexico — MX
Micronesia — FM
Moldova — MD
Monaco — MC
Mongolia — MN
Montenegro — ME
Montserrat — MS
Morocco — MA
Mozambique — MZ
Myanmar (Burma) — MM
Namibia — NA
Nauru — NR
Nepal — NP
Netherlands — NL
New Caledonia — NC
New Zealand — NZ
Nicaragua — NI
Niger — NE
Nigeria — NG
Niue — NU
Norfolk Island — NF
North Korea — KP
North Macedonia — MK
Northern Mariana Islands — MP
Norway — NO
Oman — OM
Pakistan — PK
Palau — PW
Palestinian territories — PS
Panama — PA
Papúa New Guinea — PG
Paraguay — PY
Peru — PE
Philippines — PH
Pitcairn Islands — PN
Poland — PL
Portugal — PT
Puerto Rico — PR
Qatar — QA
Reunion — RE
Romania — RO
Russia — RU
Rwanda — RW
Samoa — WS
San Marino — SM
São Tomé and Principe — ST
Saudi Arabia — SA
Senegal — SN
Serbia — RS
Seychelles — SC
Sierra Leone — SL
Singapore — SG
Sint Maarten — SX
Slovakia — SK
Slovenia — SI
Solomon Islands — SB
Somalia — SO
South Africa — ZA
South Georgia & Sandwich islands — GS
South Korea — KR
South Sudan — SS
Spain — ES
Sri Lanka — LK
St. Barthelemy — BL
St. Helena — SH
St. Kitts & Nevis — KN
St. Lucia — LC
St. Martin — MF
St. Pierre and Miquelon — PM
St. Vincent and Grenadines — VC
Sudan — SD
Suriname — SR
Svalbard & Jan Mayen — SJ
Sweden — SE
Switzerland — CH
Syria — SY
Taiwan — TW
Tajikistan — TJ
Tanzania — TZ
Thailand — TH
Timor - Lester — TL
Togo — TG
Tokelau — TK
Tonga — TO
Trinidad and Tobago — TT
Tunisia — TN
Turkey — TR
Turkmenistan — TM
Turks and Caicos Islands — TC
Tuvalu — TV
US Outlying Islands — UM
US Virgin Islands — VI
Uganda — UG
Ukraine — UA
United Arab Emirates — AE
United Kingdom — GB
United States — US
Uruguay — UY
Uzbekistan — UZ
Vanuatu — VU
Vatican City — ****
Venezuela — VE
Vietnam — VN
Wallis & Futuna — WF
Western Sahara — EH
Yemen — YE
Zambia — ZM
Zimbabwe — ZW

⚙️ This is not the full list; for the official list, see the ISO website.

Country Group Monitoring Shortcuts for the Advanced Alert

Europe

AND source_country:(AL OR AD OR AM OR AT OR AZ OR BY OR BE OR BA OR BG OR HR OR CY OR CZ OR DK OR EE OR FI OR FR OR GE OR DE OR GR OR HU OR IE OR IT OR KZ OR LV OR LI OR LT OR LU OR MT OR MD OR MC OR ME OR NL OR NO OR PL OR PT OR RO OR RU OR SM OR RS OR SK OR SI OR ES OR SE OR CH OR TR OR UA OR GB)

Africa

source_country:("DZ" OR "AO" OR "BJ" OR "BW" OR "BF" OR "BI" OR "CM" OR "CV" OR "CF" OR "TD" OR "KM" OR "CG" OR "CD" OR "CI" OR "DJ" OR "EG" OR "GQ" OR "ER" OR "ET" OR "GA" OR "GM" OR "GH" OR "GN" OR "GW" OR "KE" OR "LS" OR "LR" OR "LY" OR "MG" OR "ML" OR "MW" OR "MR" OR "MU" OR "YT" OR "MA" OR "MZ" OR "NA" OR "NE" OR "NG" OR "RE" OR "RW" OR "ST" OR "SN" OR "SC" OR "SL" OR "SO" OR "ZA" OR "SS" OR "SD" OR "SZ" OR "TZ" OR "TG" OR "TN" OR "UG" OR "EH" OR "ZM" OR "ZW")

Middle East

AND source_country:(AT OR BE OR BG OR HR OR CY OR CZ OR DK OR EE OR FI OR FR OR DE OR GR OR HU OR IE OR IT OR LV OR LI OR LT OR LU OR MT OR MD OR MC OR NL OR NO OR PL OR PT OR RO OR RU OR SM OR RS OR SK OR SI OR ES OR SE OR CH OR TR OR UA OR GB OR AE OR QA OR SA OR JO OR LB OR IQ OR IN OR IL OR EG OR OM OR BH OR KW)

LATAM

AND source_country:(BR OR PE OR MX OR CO OR AR OR VE OR CL OR EC OR GT OR CU OR BO OR DO OR HT OR HN OR PY OR SV OR NI OR CR OR PR OR PA OR UY OR SR OR GY)

Title & Body Operators

With title: and body: you can target specific parts of web publications (News, Blogs, Forums). These operators are ignored with social media sources.

Note: If web + social sources are monitored together, title: and body: apply to web content only; social content is matched by keywords without title/body scoping.

title:

Function

Search only in page/article titles.

Example

(title:("World Cup" AND Argentina))

Fetches data when both keywords appear in the title. Keywords are ignored if they only in the body content. Social posts are fetched by keywords regardless of title.

title: with groups

( title:("World Cup" AND Argentina) OR ("World Cup" AND Argentina) OR ("Women’s World Cup" AND Spain) )

body:

Search only in body paragraphs of web posts.

Example

body:("World Cup" AND 2026)

Fetches when both keywords appear in the body content. Keywords are ignored if they only appear in the title.

body: with other groups

( body:("World Cup" AND 2026)   OR ("World Cup" AND 2026)   OR title:("World Cup" AND USA)   OR ("World Cup" AND USA) )

URL: Operator

Target URLs themselves (the browser URL string) and hyperlinks within a page. You can monitor or block specific domains or URL substrings.

Syntax

  • Use quotes around full domains:

    • Moon AND url:"cnn.com"

    • Moon AND url: cnn.com

  • Plain text for substrings: Moon AND url:cnn

Non‑autonomous: must be paired with a keyword search via AND/AND NOT.

Examples

URL: & single website

Adidas AND url:"nytimes.com"

Matches: on nytimes.com, any URL containing nytimes.com, or hyperlinks to nytimes.com.

URL: & multiple websites

Adidas AND url:("nytimes.com" OR "cnn.com" OR "abcnews.com")

Matches any of those domains, URL substrings containing them, or hyperlinks to them.

URL: & text substrings

Adidas AND url:(messi OR Argentina)

Matches URLs/hyperlinks containing messi or Argentina.


Wildcard Operators

Within the Advanced Alert, Mention offers two wildcard operators that will act as text replacements for your search queries. The ? and * operators can be written inside queries to enhance your searches in a productive way. Here's how they work:

  • ? replaces one unknown character (bo?t → boat, boot, bolt…).

  • * replaces multiple unknown characters (v*d → voted, void, valid…).

Scope & Source behavior

  • On Twitter, wildcards are non‑autonomous. You must pair them with a regular keyword.

Notes & Limitations

  • Do not wrap wildcards in quotes ("car?")—that becomes literal text.

  • Do not repeat the same wildcard consecutively: l??t ❌, t**h ❌, but c?r* ✅.

  • Wildcards don’t work for 1‑character texts (e.g., a?).

  • Wildcards only work with keywords, not with other operators (e.g., url:nytimes.com* is invalid).

Examples

? operator

"mobile app" AND McDonald?

Matches McDonalds, McDonaldz, McDonaldd…

* operator

"United States" AND *iking

Matches biking, hiking, liking…


Source Operator

Limit a query to specific sources, or exclude sources.

Syntax

AND source:<SourceName> AND source:(<A> OR <B> ...) AND NOT source:<SourceName>

Scope & Source behavior

  • Non‑autonomous: link to a keyword search.

  • If you include source:, Mention will only monitor the sources listed.

  • Works with the Monitored Sources dropdown in the Advanced Alert. Keep sources enabled there; use source: in the query to target precisely. If a source is turned off in the dropdown, adding it in source: will error.

Examples

Source: & 1 monitored source

Samsung AND Galaxy AND source:twitter

Only monitors Twitter for this query.

Source: & multiple sources

Samsung AND "Galaxy Fold" AND source:(twitter OR blogs)

Monitors Twitter or Blogs only.

Source: across multiple searches

( Samsung AND "Galaxy Fold" AND source:news ) OR ( Google AND Pixel AND source:(twitter OR blogs) ) OR ( Apple AND iPhone AND source:blogs )

Social Media Account Operators (Facebook & Twitter)

source_username:

Target specific @handles on Twitter or Facebook Business Pages. This operator is non‑autonomous; it must be combined with a keyword search via AND or AND NOT.

Notes & Limitations

  • Provide exact handles to avoid generic matches (e.g., source_username:News matches any handle containing "News").

  • Use the handle as it appears in the profile URL/bio.

  • You don’t need @ in queries (source_username:burgerking ✅; @burgerking ❌).

  • Brands may use different handles per network (e.g., @mention on Twitter, @mentionapp on Facebook).

Examples

Monitored accounts

("Beyond Meat" OR "Beyond Chicken" OR "Plant-Based") AND source_username:(burgerking OR mcdonalds)

Blocked accounts

("Beyond Meat" OR "Beyond Chicken" OR "Plant-Based") AND NOT source_username:(costco OR walmart OR target)

Reach Operators

Mention can constrain results by audience size on specific sources.

Scope & Source behavior

  • Available for: Twitter, Facebook, and Web sources (News, Blogs, Forums).

  1. ❗ Reach operators do not work with Twitter Historical Data.

  2. Each reach operator is non‑autonomous; it must be paired with a keyword search.

Operators & Examples

twitter_followers:XXX

  • Behavior: filters by Twitter followers. Monitors Twitter only unless you expand with a group.

Nutella AND twitter_followers:10000 Nutella AND (twitter_followers:10000 OR NOT source:twitter)

Example

("Nutella" OR Hersheys OR "Hershey's") AND twitter_followers:500

facebook_page_likes:XXX

  • Behavior: filters Facebook pages by like count (not profiles or groups). Monitors Facebook only unless expanded.

Nutella AND facebook_page_likes:1000 Nutella AND (facebook_page_likes:1000 OR NOT source:facebook)

Example

Nutella AND biscuits AND (facebook_page_likes:1000 OR NOT source:facebook)

website_reach:XXX

  • Behavior: filters web mentions by website reach.

("Nutella" AND Oreo AND Halloween AND website_reach:5000)

To also include social media data:

("Nutella" AND Oreo AND Halloween AND website_reach:5000) OR NOT source:(web OR blogs OR forums OR news)

Commenting

You can add comments to your code by typing // followed by the comment for that line.


Thank you! Please contact [email protected] if you have any questions.

Did this answer your question?