Skip to content

Commit

Permalink
Merge f704ea8 into 33926a6
Browse files Browse the repository at this point in the history
  • Loading branch information
saippuakauppias committed Oct 3, 2020
2 parents 33926a6 + f704ea8 commit 5751527
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/notes/python-rexp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ Match hex color value
Match email
------------

.. note::

For correct email checking via regular expressions it is better to use the full version of regex:
For example: https://github.com/chartbeat-labs/textacy/blob/3466a7b/src/textacy/preprocessing/resources.py#L61-L65

.. code-block:: python
>>> re.match('^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$',
Expand All @@ -262,6 +267,11 @@ Match email
Match URL
----------

.. note::

For correct url checking via regular expressions it is better to use the full version of regex:
For example: https://github.com/chartbeat-labs/textacy/blob/3466a7b/src/textacy/preprocessing/resources.py#L12-L47

.. code-block:: python
>>> exp = re.compile(r'''^(https?:\/\/)? # match http or https
Expand Down

0 comments on commit 5751527

Please sign in to comment.