aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-09-10 20:15:43 -0400
committerBobby <[email protected]>2022-09-10 20:15:43 -0400
commitc7ce552a0e161caa2ee6dda82a0b483ff38ffd13 (patch)
tree485dba5d858397bdba7587c5bd6d6e9e616f4c18
parent9205ead31f731ac8ce7234cadc3f1d67b813b351 (diff)
downloadedify-c7ce552a0e161caa2ee6dda82a0b483ff38ffd13.tar.xz
edify-c7ce552a0e161caa2ee6dda82a0b483ff38ffd13.zip
Update docs - added more functions
-rw-r--r--README.rst7
-rw-r--r--docs/built-in/index.rst48
-rw-r--r--docs/index.rst1
3 files changed, 55 insertions, 1 deletions
diff --git a/README.rst b/README.rst
index 0783ac8..3c49998 100644
--- a/README.rst
+++ b/README.rst
@@ -67,7 +67,7 @@ Why Edify?
Regex is a powerful tool, but its syntax is not very intuitive and can be difficult to build, understand, and use. It gets even more difficult when you have to deal with backtracking, look-ahead, and other features that make regex difficult.
-That's where Edify becomes extremely useful. It allows you to create regular expressions in a programmatic way by invoking the ``RegexBuilder`` class, based on the SuperExpressive_ library. The API uses the `fluent builder pattern <https://en.wikipedia.org/wiki/Fluent_interface>`_, and is completely immutable. It is built to be discoverable and predictable.
+That's where Edify becomes extremely useful. It allows you to create regular expressions in a programmatic way by invoking the ``RegexBuilder`` class [#f1]_. The API uses the `fluent builder pattern <https://en.wikipedia.org/wiki/Fluent_interface>`_, and is completely immutable. It is built to be discoverable and predictable.
- Properties and methods describe what they do in plain English.
- Order matters! Quantifiers are specified before the thing they change, just like in English (e.g. ``RegexBuilder().exactly(5).digit()``).
@@ -140,3 +140,8 @@ Documentation
Further API documentation is available on `edify.rftd.io <https://edify.readthedocs.io>`_.
+.. rubric:: Footnotes
+
+.. [#f1] ``RegexBuilder`` class based on the `SuperExpressive`_ library.
+
+.. [1]:
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('[email protected]') # 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