One option is just to use the regex | character to try to match each of the substrings in the words in your Series s (still using str.contains).

You can construct the regex by joining the words in searchfor with |:

>>> searchfor = ['og', 'at']
>>> s[s.str.contains('|'.join(searchfor))]
0    cat
1    hat
2    dog
3    fog
dtype: object

As @AndyHayden noted in the comments below, take care if your substrings have special characters such as $ and ^ which you want to match literally. These characters have specific meanings in the context of regular expressions and will affect the matching.

You can make your list of substrings safer by escaping non-alphanumeric characters with re.escape:

>>> import re
>>> matches = ['$money', 'x^y']
>>> safe_matches = [re.escape(m) for m in matches]
>>> safe_matches
['\\$money', 'x\\^y']

The strings with in this new list will match each character literally when used with str.contains.

Answer from Alex Riley on Stack Overflow
🌐
Baeldung
baeldung.com › home › java › java string › check if a string contains multiple keywords in java
Check If a String Contains Multiple Keywords in Java | Baeldung
December 25, 2025 - In this example, we’re looking for whole words only. So, if we want to match not only the inputString but “helloBaeldung” as well, we should simply remove the onlyWholeWords() attribute from the Trie builder pipeline. In addition, keep in mind that we also remove the duplicate elements from the emits collection, as there might be multiple matches for the same keyword. In this article, we learned how to find multiple keywords inside a string.
🌐
DEV Community
dev.to › ankitvermaonline › how-to-check-if-a-string-contains-specific-words-in-php-1ho
How to check if a string contains specific words in PHP - DEV Community
December 20, 2025 - <?php $string = 'Lorem Ipsum is ... multiple specific words: If you want to check multiple words in a string, define words in an array....
Discussions

python - How to test if a string contains one of the substrings in a list, in pandas? - Stack Overflow
Highly recommend checking out this ... to the "Multiple Substring Search" subheading). ... In the specific example in the question, you could use pd.Series.str.endswith with a tuple argument: pandas.pydata.org/docs/reference/api/… ... Save this answer. ... Show activity on this post. One option is just to use the regex | character to try to match each of the substrings in the words in your Series s (still using str.contains)... More on stackoverflow.com
🌐 stackoverflow.com
python - Pandas str.contains - Search for multiple values in a string and print the values in a new column - Stack Overflow
I just started coding in Python and want to build a solution where you would search a string to see if it contains a given set of values. I've find a similar solution in R which uses the stringr l... More on stackoverflow.com
🌐 stackoverflow.com
Find column names that contain multiple strings at the same time
df[df["account"].str.contains(r'(?=.*creating)(?=.*damage)', regex=True)] or df[df["account"].str.contains('creating') & df["account"].str.contains('damage')] More on reddit.com
🌐 r/learnpython
3
1
January 10, 2022
php - Check if a string contain multiple specific words - Stack Overflow
The preferred solution, to me, should be the first. It is clear, maybe not so efficient due to the regex use but it does not report false positives and, for example, it will not trigger the echo if the string contains the word badmington More on stackoverflow.com
🌐 stackoverflow.com
🌐
Medium
medium.com › @amit25173 › understanding-pandas-str-contains-ba3e6a7d30b3
Understanding pandas str.contains() | by Amit Yadav | Medium
March 6, 2025 - It checks if either 'apple' or 'grape' exists in each string. Both 'apple' and 'grape' return True because they match. Pro tip: You can add as many words as you like, just separate them with | (e.g., 'apple|grape|banana').
Find elsewhere
🌐
Microsoft Fabric Community
community.fabric.microsoft.com › t5 › Desktop › See-if-column-string-contains-multiple-text-values › td-p › 2322714
Solved: See if column string contains multiple text values - Microsoft Fabric Community
October 26, 2022 - Searching for one word in the text is no problem, I have that working, I just can't figure it out if several words have to be looked at. hopefully someone knows a solution. thanks in advance · Solved! Go to Solution. ... Column 2 = SWITCH ( TRUE (), CONTAINSSTRING ( 'Table (4)'[Column], "text" ) && CONTAINSSTRING ( 'Table (4)'[Column], "search" ), "Group 1", CONTAINSSTRING ( 'Table (4)'[Column], "sentence" ) && CONTAINSSTRING ( 'Table (4)'[Column], "different" ), "Group 2", "Group 3" )
🌐
PHP
php.net › manual › en › function.str-contains.php
PHP: str_contains - Manual
<?php // Polyfill for PHP 4 - PHP 7, safe to utilize with PHP 8 if (!function_exists('str_contains')) { function str_contains (string $haystack, string $needle) { return empty($needle) || strpos($haystack, $needle) !== false; } } ... The code from "me at daz dot co dot uk" will not work if the word is - at the start of the string - at the end of the string - at the end of a sentence (like "the ox." or "is that an ox?") - in quotes - and so on.
🌐
Quora
quora.com › How-do-I-check-if-a-string-contains-multiple-values-in-Python
How to check if a string contains multiple values in Python - Quora
Quora is a place to gain and share knowledge. It's a platform to ask questions and connect with people who contribute unique insights and quality answers.
🌐
Statology
statology.org › home › pandas: check if string contains multiple substrings
Pandas: Check if String Contains Multiple Substrings
October 10, 2022 - We can use the following syntax to check if each string in the team column contains either the substring “Good” or “East”:
🌐
pythontutorials
pythontutorials.net › blog › how-to-use-str-contains-with-multiple-expressions-in-pandas-dataframes
How to Use str.contains() with Multiple Expressions in Pandas DataFrames (Single Line Method) — pythontutorials.net
\bslow\b ensures "slow" is matched only as a standalone word, not part of another word like "slowly". Partial match (default): str.contains("cat") matches "cat", "category", or "catastrophe".
🌐
IncludeHelp
includehelp.com › python › pandas-dataframe-str-contains-and-operation.aspx
Python - Pandas dataframe str.contains() AND operation
October 3, 2022 - # Importing pandas package import pandas as pd # Creating two dictionaries d = {'col':['A boy', 'A good boy', 'A vergy good boy', 'I am a very good boy']} # Creating DataFrame df = pd.DataFrame(d) # Display Original DataFrame print("Created DataFrame:\n",df,"\n") # Using contains and AND operation res = df[(df['col'].str.contains('good')) & (df['col'].str.contains('am'))] # Display result print("Result:\n",res)
🌐
Reddit
reddit.com › r/rlanguage › how to check for multiple substrings in a vector
r/Rlanguage on Reddit: How to check for multiple substrings in a vector
November 2, 2021 -

I have a vector of strings. Each string is an address that ends in a country name. I want to check if these addresses are in particular countries.

addresses = c("Hoofdstraat 1, Utrecht, Netherlands", "1 Main Drive, City, Maine, United States", "Äddress 1, Töwn, Sweden")
europeanCountries = c("Netherlands, "Sweden", "Ukraine")

How do I get a vector of TRUE/FALSE statements saying if an address is or isn't in Europe?

Desired output:

TRUE FALSE TRUE

I want to do this without a for-loop, if possible.

Things I tried:

addresses %in% europeanCountries #Exact matches only.
sjmisc::str_contains(europeanCountries, addresses) #Doesn't work with two factors.