Python: Find all words which are at least 4 characters long in a string
35. Words 4+ Letters
Write a Python program to find all words that are at least 4 characters long in a string.
Sample Solution:
Python Code:
import re
text = 'The quick brown fox jumps over the lazy dog.'
print(re.findall(r"\b\w{4,}\b", text))
Sample Output:
['quick', 'brown', 'jumps', 'over', 'lazy']
Pictorial Presentation:
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to extract all words with at least 4 characters from a given string.
- Write a Python script to filter a text for words with four or more letters and then print them in uppercase.
- Write a Python program to count and display words of length 4 or greater from a paragraph.
- Write a Python program to return a list of words with four or more characters from a sentence, sorted by length.
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to find all three, four, five characters long words in a string.
Next: Write a python program to convert camel case string to snake case string.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.