diff --git a/14-Strings-and-Regular-Expressions.ipynb b/14-Strings-and-Regular-Expressions.ipynb index ca39b64..0585165 100644 --- a/14-Strings-and-Regular-Expressions.ipynb +++ b/14-Strings-and-Regular-Expressions.ipynb @@ -1863,7 +1863,7 @@ } ], "source": [ - "email2 = re.compile(r'[\\w.]+@\\w+\\.[a-z]{3}')\n", + "email2 = re.compile(r'[\\w\\.]+@\\w+\\.[a-z]{3}')\n", "email2.findall('barack.obama@whitehouse.gov')" ] }, @@ -1871,7 +1871,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We have changed ``\"\\w+\"`` to ``\"[\\w.]+\"``, so we will match any alphanumeric character *or* a period.\n", + "We have changed ``\"\\w+\"`` to ``\"[\\w\\.]+\"``, so we will match any alphanumeric character *or* a period.\n", "With this more flexible expression, we can match a wider range of email addresses (though still not all – can you identify other shortcomings of this expression?)." ] }, @@ -1892,7 +1892,7 @@ }, "outputs": [], "source": [ - "email3 = re.compile(r'([\\w.]+)@(\\w+)\\.([a-z]{3})')" + "email3 = re.compile(r'([\\w\\.]+)@(\\w+)\\.([a-z]{3})')" ] }, { @@ -1946,7 +1946,7 @@ } ], "source": [ - "email4 = re.compile(r'(?P[\\w.]+)@(?P\\w+)\\.(?P[a-z]{3})')\n", + "email4 = re.compile(r'(?P[\\w\\.]+)@(?P\\w+)\\.(?P[a-z]{3})')\n", "match = email4.match('guido@python.org')\n", "match.groupdict()" ]