Creating a filtered list by comparing one list to another other list - Python
Unnecessary format strings
Unless you intend to format a string right then and there, you don't need an f before it.
Regex
This can be reduced to one line using regex:
import re

l3 = [item for item in l1 if re.match(r&quot;\w{3,5}[.]\d\s[=]\s\d{1,}&quot;, item)]

Explanation

\w{3,5} matches any word character (equal to [a-zA-Z0-9_])

{3,5} Quantifier — Matches between 3 and 5 times, as many times as possible, giving back as needed (greedy)


Match a single character present in the list below [.]

. matches the character . literally (case sensitive)

\d matches a digit (equal to [0-9])

\s matches any whitespace character (equal to [\r\n\t\f\v ])



Match a single character present in the list below [=]

= matches the character = literally (case sensitive)

\s matches any whitespace character (equal to [\r\n\t\f\v ])



\d{1,} matches a digit (equal to [0-9])

{1,} Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy)