Question: Imagine if there is a list of words like `words = ["hello","boy","cool"]` and a user input of a string `string = "helloboycool"`.

My question: Is there a way to use **Regular Expression** to find all the words in the "words" list that match a part of the input "string".

For example:
`list = ["123","hello","nice","red","boy"]` and `input = "helloniceboy"`. The input string has **no spaces**.

Using the "input" string as a search term for the **regular expression**, the output should be the words `["hello","nice","boy"]` in a list form.

**Yes, I know this could be done through simple loops. However, I just trying to work on a problem that I came across while doing my office work. So, it was worth asking this question to y'all.**
Also, thanks for all the answers. They are sure helpful insights. **Overlapping is fine**

I am fairly new to the regex thing in python.

Answer: 
Regex was made for finding things in *strings*, not lists.

I would suggest looping through the list and checking if each word is inside `string`:

```
words = ["123", "hello", "nice", "red", "boy"]
string = "helloboycool"
result = []
for word in words:
    if word in string:
        result.append(word)
print(result)

```

You *could* use regex for this, but I wouldn't suggest it - this is much cleaner and faster.

Here is a version with `list comprehension`:

```
words = ["123", "hello", "nice", "red", "boy"]
string = "helloboycool"
result = [word for word in words if word in string]

```
Does it have to be a regex? It can be done easily like this:

```py
list = ["123", "hello", "red", "nice", "happy", "boy"]
input = "helloniceboy"

result = []
for i in list:
    if i in input:
        result.append(i)

print(result)

```

If it **has** to be regex, there is a built-in module called `re` which you can use.