cara menggunakan regex dalam daftar

# list filtering with regex
import re
l = ['...', 'ram', 'karan','..','......', '....']

pattern = re.compile("\.\.+")
lst = [x for x in l if not re.match(pattern, x)]
print(lst)

# output 
['ram', 'karan']
Frantic Ferret