docs: Add skeleton docs for ure module.
This commit is contained in:
parent
cd97a43f8d
commit
3a5352b483
@ -42,6 +42,7 @@ it will fallback to loading the built-in ``ujson`` module.
|
||||
uhashlib.rst
|
||||
uheapq.rst
|
||||
ujson.rst
|
||||
ure.rst
|
||||
usocket.rst
|
||||
|
||||
Libraries specific to the pyboard
|
||||
|
82
docs/library/ure.rst
Normal file
82
docs/library/ure.rst
Normal file
@ -0,0 +1,82 @@
|
||||
:mod:`ure` -- regular expressions
|
||||
=================================
|
||||
|
||||
.. module:: ure
|
||||
:synopsis: regular expressions
|
||||
|
||||
This module implements regular expression operations. Regular expression
|
||||
syntax supported is a subset of CPython ``re`` module (and actually is
|
||||
a subset of POSIX extended regular expressions).
|
||||
|
||||
Supported operators are:
|
||||
|
||||
``'.'``
|
||||
Match any character.
|
||||
|
||||
``'[]'``
|
||||
Match set of characters. Individual characters and ranges are supported.
|
||||
|
||||
``'^'``
|
||||
|
||||
``'$'``
|
||||
|
||||
``'?'``
|
||||
|
||||
``'*'``
|
||||
|
||||
``'+'``
|
||||
|
||||
``'??'``
|
||||
|
||||
``'*?'``
|
||||
|
||||
``'+?'``
|
||||
|
||||
Counted repetitions (``{m,n}``), more advanced assertions, names groups,
|
||||
etc. are not supported.
|
||||
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
.. function:: compile(regex)
|
||||
|
||||
Compile regular expression, return ``regex`` object.
|
||||
|
||||
.. function:: match(regex, string)
|
||||
|
||||
Match ``regex`` against ``string``. Match always happens from starting
|
||||
position in a string.
|
||||
|
||||
.. function:: search(regex, string)
|
||||
|
||||
Search ``regex`` in a ``string``. Unlike ``match``, this will search
|
||||
string for first position which matches regex (which still may be
|
||||
0 if regex is anchored).
|
||||
|
||||
.. data:: DEBUG
|
||||
|
||||
Flag value, display debug information about compiled expression.
|
||||
|
||||
|
||||
Regex objects
|
||||
-------------
|
||||
|
||||
Compiled regular expression. Instances of this class are created using
|
||||
``ure.compile()``.
|
||||
|
||||
.. method:: regex.match(string)
|
||||
|
||||
.. method:: regex.search(string)
|
||||
|
||||
.. method:: regex.split(string, max_split=-1)
|
||||
|
||||
|
||||
Match objects
|
||||
-------------
|
||||
|
||||
Match objects as returned by ``match()`` and ``search()`` methods.
|
||||
|
||||
.. method:: match.group([index])
|
||||
|
||||
Only numeric groups are supported.
|
Loading…
x
Reference in New Issue
Block a user