Python Tip #92 (of 365):
Don't overuse regular expressions
If a containment check of a common string method will do, don't use a regular expression.
Instead of this:
if reβ.search(r"^http://", string):
Do this:
if string.startswith("http://"):
Instead of this:
if reβ.search(r"#", string):
Do this:
if "#" in string:
And instead of this:
parts = re.findall(r"\S+", string)
Do this:
parts = string.split()
π§΅ (1/2)
