From c7ce552a0e161caa2ee6dda82a0b483ff38ffd13 Mon Sep 17 00:00:00 2001 From: Bobby Date: Sat, 10 Sep 2022 20:15:43 -0400 Subject: Update docs - added more functions --- docs/built-in/index.rst | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 1 + 2 files changed, 49 insertions(+) create mode 100644 docs/built-in/index.rst (limited to 'docs') diff --git a/docs/built-in/index.rst b/docs/built-in/index.rst new file mode 100644 index 0000000..8d51c58 --- /dev/null +++ b/docs/built-in/index.rst @@ -0,0 +1,48 @@ +Pre-Built Pattern API Reference +================================ + +Edify allows you to verify a string quickly by providing commonly used regex patterns in its extensive set of built-in patterns. To tap into a pattern, simply import the pattern function from the ``edify.library`` module. For example, to verify that a string is a valid email address, you can use the ``email`` pattern. The pattern will return either ``True`` or ``False`` depending on whether the string matches the pattern. + +email() +------- + +The ``email`` function verifies that a string is a valid email address. The function takes a ``string`` argument which is supposed to be a valid email address. The function returns ``True`` if the string is a valid email address, and ``False`` otherwise. + +.. warning:: + + The ``email`` function is not a complete email address validator. It only checks that the string is in the correct format. It does not check that the domain name is valid or that the email address actually exists. + +To use the ``email`` function, import it from the ``edify.library`` module. + +.. code-block:: python + + from edify.library import email + +Then, call the ``email`` function with a string argument. + +.. code-block:: python + + email('hello@example.com') # returns True + email('hello') # returns False + +phone() +------- + +The ``phone`` function verifies that a string is a valid phone number. The function takes a ``string`` argument which is supposed to be a valid phone number. The function returns ``True`` if the string is a valid phone number, and ``False`` otherwise. + +.. warning:: + + The ``phone`` function is not a complete phone number validator. It only checks that the string is in the correct format. It does not check that the phone number actually exists. + +You can use the ``phone`` function as follows: + +.. code-block:: python + + from edify.library import phone + + phone('1234567890') # returns True + phone('123456789') # returns False + phone('+1 (123) 456-7890') # returns True + phone('123-456-7890') # returns True + phone('9012') # returns False + phone('+1 (615) 243-') # returns False diff --git a/docs/index.rst b/docs/index.rst index 831bf7d..e209f14 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,6 +6,7 @@ Contents :maxdepth: 3 readme + built-in/index regex-builder/index contributing authors -- cgit v1.2.3