Update documentation
This commit is contained in:
parent
c31870d311
commit
e6dbb350a9
1 changed files with 38 additions and 37 deletions
75
src/nre.nim
75
src/nre.nim
|
|
@ -47,14 +47,7 @@ from unicode import runeLenAt
|
||||||
type
|
type
|
||||||
Regex* = ref object
|
Regex* = ref object
|
||||||
## Represents the pattern that things are matched against, constructed with
|
## Represents the pattern that things are matched against, constructed with
|
||||||
## ``re(string, string)``. Examples: ``re"foo"``, ``re(r"foo # comment",
|
## ``re(string)``. Examples: ``re"foo"``, ``re(r"(*ANYCRLF)(?x)foo # comment".
|
||||||
## "x<anycrlf>")``, ``re"(?x)(*ANYCRLF)foo # comment"``. For more details
|
|
||||||
## on the leading option groups, see the `Option
|
|
||||||
## Setting <http://man7.org/linux/man-pages/man3/pcresyntax.3.html#OPTION_SETTING>`__
|
|
||||||
## and the `Newline
|
|
||||||
## Convention <http://man7.org/linux/man-pages/man3/pcresyntax.3.html#NEWLINE_CONVENTION>`__
|
|
||||||
## sections of the `PCRE syntax
|
|
||||||
## manual <http://man7.org/linux/man-pages/man3/pcresyntax.3.html>`__.
|
|
||||||
##
|
##
|
||||||
## ``pattern: string``
|
## ``pattern: string``
|
||||||
## the string that was used to create the pattern.
|
## the string that was used to create the pattern.
|
||||||
|
|
@ -66,33 +59,36 @@ type
|
||||||
## a table from the capture names to their numeric id.
|
## a table from the capture names to their numeric id.
|
||||||
##
|
##
|
||||||
##
|
##
|
||||||
## Flags
|
## Options
|
||||||
## .....
|
## .......
|
||||||
##
|
##
|
||||||
## - ``8``, ``u``, ``<utf8>`` - treat both the pattern and subject as UTF8
|
## The following options may appear anywhere in the pattern, and they affect
|
||||||
## - ``9``, ``<no_utf8>`` - prevents the pattern from being interpreted as UTF, no matter
|
## the rest of it.
|
||||||
## what
|
##
|
||||||
## - ``A``, ``<anchored>`` - as if the pattern had a ``^`` at the beginning
|
## - ``(?i)`` - case insensitive
|
||||||
## - ``E``, ``<dollar_endonly>`` - DOLLAR\_ENDONLY
|
## - ``(?m)`` - multi-line: ``^`` and ``$`` match the beginning and end of
|
||||||
## - ``f``, ``<firstline>`` - fails if there is not a match on the first line
|
|
||||||
## - ``i``, ``<case_insensitive>`` - case insensitive
|
|
||||||
## - ``m``, ``<multiline>`` - multi-line, ``^`` and ``$`` match the beginning and end of
|
|
||||||
## lines, not of the subject string
|
## lines, not of the subject string
|
||||||
## - ``N``, ``<no_auto_capture>`` - turn off auto-capture, ``(?foo)`` is necessary to capture.
|
## - ``(?s)`` - ``.`` also matches newline (*dotall*)
|
||||||
## - ``s``, ``<dotall>`` - ``.`` matches newline
|
## - ``(?U)`` - expressions are not greedy by default. ``?`` can be added
|
||||||
## - ``U``, ``<ungreedy>`` - expressions are not greedy by default. ``?`` can be added to
|
## to a qualifier to make it greedy
|
||||||
## a qualifier to make it greedy.
|
## - ``(?x)`` - whitespace and comments (``#``) are ignored (*extended*)
|
||||||
## - ``W``, ``<ucp>`` - Unicode character properties; ``\w`` matches ``к``.
|
## - ``(?X)`` - character escapes without special meaning (``\w`` vs.
|
||||||
## - ``X``, ``<extra>`` - "Extra", character escapes without special meaning (``\w``
|
## ``\a``) are errors (*extra*)
|
||||||
## vs. ``\a``) are errors
|
##
|
||||||
## - ``x``, ``<extended>`` - extended, comments (``#``) and newlines are ignored
|
## One or a combination of these options may appear only at the beginning
|
||||||
## (extended)
|
## of the pattern:
|
||||||
## - ``Y``, ``<no_start_optimize>`` - pcre.NO\_START\_OPTIMIZE,
|
##
|
||||||
## - ``<cr>`` - newlines are separated by ``\r``
|
## - ``(*UTF8)`` - treat both the pattern and subject as UTF-8
|
||||||
## - ``<crlf>`` - newlines are separated by ``\r\n`` (Windows default)
|
## - ``(*UCP)`` - Unicode character properties; ``\w`` matches ``я``
|
||||||
## - ``<lf>`` - newlines are separated by ``\n`` (UNIX default)
|
## - ``(*U)`` - a combination of the two options above
|
||||||
## - ``<anycrlf>`` - newlines are separated by any of the above
|
## - ``(*FIRSTLINE*)`` - fails if there is not a match on the first line
|
||||||
## - ``<any>`` - newlines are separated by any of the above and Unicode
|
## - ``(*NO_AUTO_CAPTURE)`` - turn off auto-capture for groups;
|
||||||
|
## ``(?<name>...)`` can be used to capture
|
||||||
|
## - ``(*CR)`` - newlines are separated by ``\r``
|
||||||
|
## - ``(*LF)`` - newlines are separated by ``\n`` (UNIX default)
|
||||||
|
## - ``(*CRLF)`` - newlines are separated by ``\r\n`` (Windows default)
|
||||||
|
## - ``(*ANYCRLF)`` - newlines are separated by any of the above
|
||||||
|
## - ``(*ANY)`` - newlines are separated by any of the above and Unicode
|
||||||
## newlines:
|
## newlines:
|
||||||
##
|
##
|
||||||
## single characters VT (vertical tab, U+000B), FF (form feed, U+000C),
|
## single characters VT (vertical tab, U+000B), FF (form feed, U+000C),
|
||||||
|
|
@ -101,10 +97,15 @@ type
|
||||||
## are recognized only in UTF-8 mode.
|
## are recognized only in UTF-8 mode.
|
||||||
## — man pcre
|
## — man pcre
|
||||||
##
|
##
|
||||||
## - ``<bsr_anycrlf>`` - ``\R`` matches CR, LF, or CRLF
|
## - ``(*JAVASCRIPT_COMPAT)`` - JavaScript compatibility
|
||||||
## - ``<bsr_unicode>`` - ``\R`` matches any unicode newline
|
## - ``(*NO_STUDY)`` - turn off studying; study is enabled by default
|
||||||
## - ``<js>`` - Javascript compatibility
|
##
|
||||||
## - ``<no_study>`` - turn off studying; study is enabled by deafault
|
## For more details on the leading option groups, see the `Option
|
||||||
|
## Setting <http://man7.org/linux/man-pages/man3/pcresyntax.3.html#OPTION_SETTING>`__
|
||||||
|
## and the `Newline
|
||||||
|
## Convention <http://man7.org/linux/man-pages/man3/pcresyntax.3.html#NEWLINE_CONVENTION>`__
|
||||||
|
## sections of the `PCRE syntax
|
||||||
|
## manual <http://man7.org/linux/man-pages/man3/pcresyntax.3.html>`__.
|
||||||
pattern*: string ## not nil
|
pattern*: string ## not nil
|
||||||
pcreObj: ptr pcre.Pcre ## not nil
|
pcreObj: ptr pcre.Pcre ## not nil
|
||||||
pcreExtra: ptr pcre.ExtraData ## nil
|
pcreExtra: ptr pcre.ExtraData ## nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue