summary refs log tree commit diff stats
path: root/lib/impure/re.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/impure/re.nim')
-rw-r--r--lib/impure/re.nim23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/impure/re.nim b/lib/impure/re.nim
index fb95610f6..60bb6c77f 100644
--- a/lib/impure/re.nim
+++ b/lib/impure/re.nim
@@ -7,11 +7,8 @@
 #    distribution, for details about the copyright.
 #
 
-## Regular expression support for Nim. Consider using the pegs module instead.
-##
-## There is an alternative regular expressions library with a more unified API:
-## `nre <https://github.com/flaviut/nre>`_. It may be added to the standard
-## library in the future, instead of `re`.
+## Regular expression support for Nim. Deprecated. Consider using the ``nre``
+## or ``pegs`` modules instead.
 ##
 ## **Note:** The 're' proc defaults to the **extended regular expression
 ## syntax** which lets you use whitespace freely to make your regexes readable.
@@ -31,6 +28,8 @@
 import
   pcre, strutils, rtarrays
 
+{.deprecated.}
+
 const
   MaxSubpatterns* = 20
     ## defines the maximum number of subpatterns that can be captured.
@@ -44,11 +43,11 @@ type
     reExtended = 3,      ## ignore whitespace and ``#`` comments
     reStudy = 4          ## study the expression (may be omitted if the
                          ## expression will be used only once)
-  
-  RegexDesc = object 
+
+  RegexDesc = object
     h: ptr Pcre
     e: ptr ExtraData
-  
+
   Regex* = ref RegexDesc ## a compiled regular expression
 
   RegexError* = object of ValueError
@@ -79,7 +78,7 @@ proc finalizeRegEx(x: Regex) =
   if not isNil(x.e):
     pcre.free_substring(cast[cstring](x.e))
 
-proc re*(s: string, flags = {reExtended, reStudy}): Regex =
+proc re*(s: string, flags = {reExtended, reStudy}): Regex {.deprecated.} =
   ## Constructor of regular expressions. Note that Nim's
   ## extended raw string literals support this syntax ``re"[abc]"`` as
   ## a short form for ``re(r"[abc]")``.
@@ -146,8 +145,8 @@ proc findBounds*(s: string, pattern: Regex,
 
 proc findBounds*(s: string, pattern: Regex,
                  start = 0): tuple[first, last: int] =
-  ## returns the starting position of `pattern` in `s`. If it does not
-  ## match, ``(-1,0)`` is returned.
+  ## returns the starting position and end position of ``pattern`` in ``s``.
+  ## If it does not match, ``(-1,0)`` is returned.
   var
     rtarray = initRtArray[cint](3)
     rawMatches = rtarray.getRawData
@@ -372,7 +371,7 @@ iterator split*(s: string, sep: Regex): string =
   ##
   ## .. code-block:: nim
   ##   for word in split("00232this02939is39an22example111", re"\d+"):
-  ##     writeln(stdout, word)
+  ##     writeLine(stdout, word)
   ##
   ## Results in:
   ##