Files
Nim/nre.html
github-actions[bot] c7440eccf2 Deploy to GitHub pages
2025-09-27 04:02:34 +00:00

972 lines
124 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/nre</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/nre</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<ul class="simple"><li><a class="reference" id="licencing-options_toc" href="#licencing-options">Options</a></li>
</ul><li><a class="reference" id="what-is-nreqmark_toc" href="#what-is-nreqmark">What is NRE?</a></li>
<ul class="simple"><li><a class="reference" id="what-is-nreqmark-licencing_toc" href="#what-is-nreqmark-licencing">Licencing</a></li>
</ul><li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#CaptureBounds" title="CaptureBounds = distinct RegexMatch">CaptureBounds</a></li>
<li><a class="reference" href="#Captures" title="Captures = distinct RegexMatch">Captures</a></li>
<li><a class="reference" href="#InvalidUnicodeError" title="InvalidUnicodeError = ref object of RegexError
pos*: int ## the location of the invalid unicode in bytes">InvalidUnicodeError</a></li>
<li><a class="reference" href="#Regex" title="Regex = ref RegexDesc">Regex</a></li>
<li><a class="reference" href="#RegexDesc" title="RegexDesc = object
pattern*: string
## not nil
## nil">RegexDesc</a></li>
<li><a class="reference" href="#RegexError" title="RegexError = ref object of CatchableError">RegexError</a></li>
<li><a class="reference" href="#RegexInternalError" title="RegexInternalError = ref object of RegexError">RegexInternalError</a></li>
<li><a class="reference" href="#RegexMatch" title="RegexMatch = object
pattern*: Regex ## The regex doing the matching.
## Not nil.
str*: string ## The string that was matched against.
## First item is the bounds of the match
## Other items are the captures
## `a` is inclusive start, `b` is exclusive end">RegexMatch</a></li>
<li><a class="reference" href="#StudyError" title="StudyError = ref object of RegexError">StudyError</a></li>
<li><a class="reference" href="#SyntaxError" title="SyntaxError = ref object of RegexError
pos*: int ## the location of the syntax error in bytes
pattern*: string ## the pattern that caused the problem">SyntaxError</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CRegexMatch" title="`$`(pattern: RegexMatch): string">`$`(pattern: RegexMatch): string</a></li>
</ul>
<ul class="simple nested-toc-section">==
<li><a class="reference" href="#%3D%3D%2CRegex%2CRegex" title="`==`(a, b: Regex): bool">`==`(a, b: Regex): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CRegexMatch%2CRegexMatch" title="`==`(a, b: RegexMatch): bool">`==`(a, b: RegexMatch): bool</a></li>
</ul>
<ul class="simple nested-toc-section">[]
<li><a class="reference" href="#%5B%5D%2CCaptureBounds%2Cint" title="`[]`(pattern: CaptureBounds; i: int): HSlice[int, int]">`[]`(pattern: CaptureBounds; i: int): HSlice[int, int]</a></li>
<li><a class="reference" href="#%5B%5D%2CCaptureBounds%2Cstring" title="`[]`(pattern: CaptureBounds; name: string): HSlice[int, int]">`[]`(pattern: CaptureBounds; name: string): HSlice[int, int]</a></li>
<li><a class="reference" href="#%5B%5D%2CCaptures%2Cint" title="`[]`(pattern: Captures; i: int): string">`[]`(pattern: Captures; i: int): string</a></li>
<li><a class="reference" href="#%5B%5D%2CCaptures%2Cstring" title="`[]`(pattern: Captures; name: string): string">`[]`(pattern: Captures; name: string): string</a></li>
</ul>
<ul class="simple nested-toc-section">captureBounds
<li><a class="reference" href="#captureBounds%2CRegexMatch" title="captureBounds(pattern: RegexMatch): CaptureBounds">captureBounds(pattern: RegexMatch): CaptureBounds</a></li>
</ul>
<ul class="simple nested-toc-section">captureCount
<li><a class="reference" href="#captureCount%2CRegex" title="captureCount(pattern: Regex): int">captureCount(pattern: Regex): int</a></li>
</ul>
<ul class="simple nested-toc-section">captureNameId
<li><a class="reference" href="#captureNameId%2CRegex" title="captureNameId(pattern: Regex): Table[string, int]">captureNameId(pattern: Regex): Table[string, int]</a></li>
</ul>
<ul class="simple nested-toc-section">captures
<li><a class="reference" href="#captures%2CRegexMatch" title="captures(pattern: RegexMatch): Captures">captures(pattern: RegexMatch): Captures</a></li>
</ul>
<ul class="simple nested-toc-section">contains
<li><a class="reference" href="#contains%2CCaptureBounds%2Cint" title="contains(pattern: CaptureBounds; i: int): bool">contains(pattern: CaptureBounds; i: int): bool</a></li>
<li><a class="reference" href="#contains%2CCaptureBounds%2Cstring" title="contains(pattern: CaptureBounds; name: string): bool">contains(pattern: CaptureBounds; name: string): bool</a></li>
<li><a class="reference" href="#contains%2CCaptures%2Cint" title="contains(pattern: Captures; i: int): bool">contains(pattern: Captures; i: int): bool</a></li>
<li><a class="reference" href="#contains%2CCaptures%2Cstring" title="contains(pattern: Captures; name: string): bool">contains(pattern: Captures; name: string): bool</a></li>
<li><a class="reference" href="#contains%2Cstring%2CRegex%2Cint" title="contains(str: string; pattern: Regex; start = 0; endpos = int.high): bool">contains(str: string; pattern: Regex; start = 0; endpos = int.high): bool</a></li>
</ul>
<ul class="simple nested-toc-section">escapeRe
<li><a class="reference" href="#escapeRe%2Cstring" title="escapeRe(str: string): string">escapeRe(str: string): string</a></li>
</ul>
<ul class="simple nested-toc-section">find
<li><a class="reference" href="#find%2Cstring%2CRegex%2Cint" title="find(str: string; pattern: Regex; start = 0; endpos = int.high): Option[
RegexMatch]">find(str: string; pattern: Regex; start = 0; endpos = int.high): Option[
RegexMatch]</a></li>
</ul>
<ul class="simple nested-toc-section">findAll
<li><a class="reference" href="#findAll%2Cstring%2CRegex%2Cint" title="findAll(str: string; pattern: Regex; start = 0; endpos = int.high): seq[string]">findAll(str: string; pattern: Regex; start = 0; endpos = int.high): seq[string]</a></li>
</ul>
<ul class="simple nested-toc-section">match
<li><a class="reference" href="#match%2CRegexMatch" title="match(pattern: RegexMatch): string">match(pattern: RegexMatch): string</a></li>
<li><a class="reference" href="#match%2Cstring%2CRegex%2Cint" title="match(str: string; pattern: Regex; start = 0; endpos = int.high): Option[
RegexMatch]">match(str: string; pattern: Regex; start = 0; endpos = int.high): Option[
RegexMatch]</a></li>
</ul>
<ul class="simple nested-toc-section">matchBounds
<li><a class="reference" href="#matchBounds%2CRegexMatch" title="matchBounds(pattern: RegexMatch): HSlice[int, int]">matchBounds(pattern: RegexMatch): HSlice[int, int]</a></li>
</ul>
<ul class="simple nested-toc-section">re
<li><a class="reference" href="#re%2Cstring" title="re(pattern: string): Regex">re(pattern: string): Regex</a></li>
</ul>
<ul class="simple nested-toc-section">replace
<li><a class="reference" href="#replace%2Cstring%2CRegex%2Cstring" title="replace(str: string; pattern: Regex; sub: string): string">replace(str: string; pattern: Regex; sub: string): string</a></li>
<li><a class="reference" href="#replace%2Cstring%2CRegex%2Cproc%28RegexMatch%29" title="replace(str: string; pattern: Regex; subproc: proc (match: RegexMatch): string): string">replace(str: string; pattern: Regex; subproc: proc (match: RegexMatch): string): string</a></li>
<li><a class="reference" href="#replace%2Cstring%2CRegex%2Cproc%28string%29" title="replace(str: string; pattern: Regex; subproc: proc (match: string): string): string">replace(str: string; pattern: Regex; subproc: proc (match: string): string): string</a></li>
</ul>
<ul class="simple nested-toc-section">split
<li><a class="reference" href="#split%2Cstring%2CRegex%2Cint%2Cint" title="split(str: string; pattern: Regex; maxSplit = -1; start = 0): seq[string]">split(str: string; pattern: Regex; maxSplit = -1; start = 0): seq[string]</a></li>
</ul>
<ul class="simple nested-toc-section">toSeq
<li><a class="reference" href="#toSeq%2CCaptureBounds" title="toSeq(pattern: CaptureBounds; default = none(HSlice[int, int])): seq[
Option[HSlice[int, int]]]">toSeq(pattern: CaptureBounds; default = none(HSlice[int, int])): seq[
Option[HSlice[int, int]]]</a></li>
<li><a class="reference" href="#toSeq%2CCaptures%2COption%5Bstring%5D" title="toSeq(pattern: Captures; default: Option[string] = none(string)): seq[
Option[string]]">toSeq(pattern: Captures; default: Option[string] = none(string)): seq[
Option[string]]</a></li>
</ul>
<ul class="simple nested-toc-section">toTable
<li><a class="reference" href="#toTable%2CCaptureBounds" title="toTable(pattern: CaptureBounds): Table[string, HSlice[int, int]]">toTable(pattern: CaptureBounds): Table[string, HSlice[int, int]]</a></li>
<li><a class="reference" href="#toTable%2CCaptures" title="toTable(pattern: Captures): Table[string, string]">toTable(pattern: Captures): Table[string, string]</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">findIter
<li><a class="reference" href="#findIter.i%2Cstring%2CRegex%2Cint" title="findIter(str: string; pattern: Regex; start = 0; endpos = int.high): RegexMatch">findIter(str: string; pattern: Regex; start = 0; endpos = int.high): RegexMatch</a></li>
</ul>
<ul class="simple nested-toc-section">items
<li><a class="reference" href="#items.i%2CCaptureBounds" title="items(pattern: CaptureBounds; default = none(HSlice[int, int])): Option[
HSlice[int, int]]">items(pattern: CaptureBounds; default = none(HSlice[int, int])): Option[
HSlice[int, int]]</a></li>
<li><a class="reference" href="#items.i%2CCaptures%2COption%5Bstring%5D" title="items(pattern: Captures; default: Option[string] = none(string)): Option[string]">items(pattern: Captures; default: Option[string] = none(string)): Option[string]</a></li>
</ul>
</ul>
</details>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">
<h1><a class="toc-backref" id="what-is-nreqmark" href="#what-is-nreqmark">What is NRE?</a></h1><p>A regular expression library for Nim using PCRE to do the hard work.</p>
<p>For documentation on how to write patterns, there exists <a class="reference external" href="https://www.pcre.org/original/doc/html/pcrepattern.html">the official PCRE pattern documentation</a>. You can also search the internet for a wide variety of third-party documentation and tools.</p>
<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
If you love <tt class="docutils literal"><span class="pre"><span class="Identifier">sequtils</span><span class="Operator">.</span><span class="Identifier">toSeq</span></span></tt> we have bad news for you. This library doesn't work with it due to documented compiler limitations. As a workaround, use this:</div>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">nre</span>
<span class="Comment"># either `import std/nre except toSeq` or fully qualify `sequtils.toSeq`:</span>
<span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">sequtils</span>
<span class="Keyword">iterator</span> <span class="Identifier">iota</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">int</span> <span class="Operator">=</span>
<span class="Keyword">for</span> <span class="Identifier">i</span> <span class="Keyword">in</span> <span class="FloatNumber">0.</span><span class="Operator">.&lt;</span><span class="Identifier">n</span><span class="Punctuation">:</span> <span class="Keyword">yield</span> <span class="Identifier">i</span>
<span class="Identifier">assert</span> <span class="Identifier">sequtils</span><span class="Operator">.</span><span class="Identifier">toSeq</span><span class="Punctuation">(</span><span class="Identifier">iota</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span></pre><div class="admonition admonition-info"><span class="admonition-info-text"><b>Note:</b></span>
There are also alternative nimble packages such as <a class="reference external" href="https://github.com/khchen/tinyre">tinyre</a> and <a class="reference external" href="https://github.com/nitely/nim-regex">regex</a>.</div>
<h2><a class="toc-backref" id="what-is-nreqmark-licencing" href="#what-is-nreqmark-licencing">Licencing</a></h2><p>PCRE has <a class="reference external" href="https://pcre.sourceforge.net/license.txt">some additional terms</a> that you must agree to in order to use this module.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">nre</span>
<span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">sugar</span>
<span class="Keyword">let</span> <span class="Identifier">vowels</span> <span class="Operator">=</span> <span class="RawData">re&quot;[aeoui]&quot;</span>
<span class="Keyword">let</span> <span class="Identifier">bounds</span> <span class="Operator">=</span> <span class="Identifier">collect</span><span class="Punctuation">:</span>
<span class="Keyword">for</span> <span class="Identifier">match</span> <span class="Keyword">in</span> <span class="StringLit">&quot;moiga&quot;</span><span class="Operator">.</span><span class="Identifier">findIter</span><span class="Punctuation">(</span><span class="Identifier">vowels</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">match</span><span class="Operator">.</span><span class="Identifier">matchBounds</span>
<span class="Identifier">assert</span> <span class="Identifier">bounds</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span> <span class="Operator">..</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">4</span> <span class="Operator">..</span> <span class="DecNumber">4</span><span class="Punctuation">]</span>
<span class="Keyword">from</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">sequtils</span> <span class="Keyword">import</span> <span class="Identifier">toSeq</span>
<span class="Keyword">let</span> <span class="Identifier">s</span> <span class="Operator">=</span> <span class="Identifier">sequtils</span><span class="Operator">.</span><span class="Identifier">toSeq</span><span class="Punctuation">(</span><span class="StringLit">&quot;moiga&quot;</span><span class="Operator">.</span><span class="Identifier">findIter</span><span class="Punctuation">(</span><span class="Identifier">vowels</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Comment"># fully qualified to avoid confusion with nre.toSeq</span>
<span class="Identifier">assert</span> <span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">len</span> <span class="Operator">==</span> <span class="DecNumber">3</span>
<span class="Keyword">let</span> <span class="Identifier">firstVowel</span> <span class="Operator">=</span> <span class="StringLit">&quot;foo&quot;</span><span class="Operator">.</span><span class="Identifier">find</span><span class="Punctuation">(</span><span class="Identifier">vowels</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">hasVowel</span> <span class="Operator">=</span> <span class="Identifier">firstVowel</span><span class="Operator">.</span><span class="Identifier">isSome</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">hasVowel</span>
<span class="Keyword">let</span> <span class="Identifier">matchBounds</span> <span class="Operator">=</span> <span class="Identifier">firstVowel</span><span class="Operator">.</span><span class="Identifier">get</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">captureBounds</span><span class="Punctuation">[</span><span class="Operator">-</span><span class="DecNumber">1</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">matchBounds</span><span class="Operator">.</span><span class="Identifier">a</span> <span class="Operator">==</span> <span class="DecNumber">1</span>
<span class="Comment"># as with module `re`, unless specified otherwise, `start` parameter in each</span>
<span class="Comment"># proc indicates where the scan starts, but outputs are relative to the start</span>
<span class="Comment"># of the input string, not to `start`:</span>
<span class="Identifier">assert</span> <span class="Identifier">find</span><span class="Punctuation">(</span><span class="StringLit">&quot;uxabc&quot;</span><span class="Punctuation">,</span> <span class="RawData">re&quot;(?&lt;=x|y)ab&quot;</span><span class="Punctuation">,</span> <span class="Identifier">start</span> <span class="Operator">=</span> <span class="DecNumber">1</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">get</span><span class="Operator">.</span><span class="Identifier">captures</span><span class="Punctuation">[</span><span class="Operator">-</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;ab&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">find</span><span class="Punctuation">(</span><span class="StringLit">&quot;uxabc&quot;</span><span class="Punctuation">,</span> <span class="RawData">re&quot;ab&quot;</span><span class="Punctuation">,</span> <span class="Identifier">start</span> <span class="Operator">=</span> <span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">isNone</span></pre></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="pcre.html">pcre</a>, <a class="reference external" href="util.html">util</a>, <a class="reference external" href="tables.html">tables</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="unicode.html">unicode</a>, <a class="reference external" href="assertions.html">assertions</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="CaptureBounds">
<dt><pre><a href="nre.html#CaptureBounds"><span class="Identifier">CaptureBounds</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L199" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L199" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="Captures">
<dt><pre><a href="nre.html#Captures"><span class="Identifier">Captures</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L198" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L198" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="InvalidUnicodeError">
<dt><pre><a href="nre.html#InvalidUnicodeError"><span class="Identifier">InvalidUnicodeError</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="nre.html#RegexError"><span class="Identifier">RegexError</span></a>
<span class="Identifier">pos</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> <span class="Comment">## the location of the invalid unicode in bytes</span></pre></dt>
<dd>
Thrown when matching fails due to invalid unicode in strings
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L206" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L206" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="Regex">
<dt><pre><a href="nre.html#Regex"><span class="Identifier">Regex</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <a href="nre.html#RegexDesc"><span class="Identifier">RegexDesc</span></a></pre></dt>
<dd>
Represents the pattern that things are matched against, constructed with <tt class="docutils literal"><span class="pre"><span class="Identifier">re</span><span class="Punctuation">(</span><span class="Identifier">string</span><span class="Punctuation">)</span></span></tt>. Examples: <tt class="docutils literal"><span class="pre"><span class="RawData">re&quot;foo&quot;</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">re</span><span class="Punctuation">(</span><span class="RawData">r&quot;(*ANYCRLF)(?x)foo # comment&quot;</span><span class="Operator">.</span></span></tt><dl class="docutils"><dt><tt class="docutils literal"><span class="pre"><span class="Identifier">pattern</span><span class="Punctuation">:</span> <span class="Identifier">string</span></span></tt></dt>
<dd>the string that was used to create the pattern. For details on how to write a pattern, please see <a class="reference external" href="https://www.pcre.org/original/doc/html/pcrepattern.html">the official PCRE pattern documentation.</a></dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Identifier">captureCount</span><span class="Punctuation">:</span> <span class="Identifier">int</span></span></tt></dt>
<dd>the number of captures that the pattern has.</dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Identifier">captureNameId</span><span class="Punctuation">:</span> <span class="Identifier">Table</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">,</span> <span class="Identifier">int</span><span class="Punctuation">]</span></span></tt></dt>
<dd>a table from the capture names to their numeric id.</dd>
</dl>
<h3><a class="toc-backref" id="licencing-options" href="#licencing-options">Options</a></h3><p>The following options may appear anywhere in the pattern, and they affect the rest of it.</p>
<ul class="simple"><li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">?</span><span class="Identifier">i</span><span class="Punctuation">)</span></span></tt> - case insensitive</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">?</span><span class="Identifier">m</span><span class="Punctuation">)</span></span></tt> - multi-line: <tt class="docutils literal"><span class="pre"><span class="Operator">^</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Operator">$</span></span></tt> match the beginning and end of lines, not of the subject string</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">?</span><span class="Identifier">s</span><span class="Punctuation">)</span></span></tt> - <tt class="docutils literal"><span class="pre"><span class="Operator">.</span></span></tt> also matches newline (<em>dotall</em>)</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">?</span><span class="Identifier">U</span><span class="Punctuation">)</span></span></tt> - expressions are not greedy by default. <tt class="docutils literal"><span class="pre"><span class="Operator">?</span></span></tt> can be added to a qualifier to make it greedy</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">?</span><span class="Identifier">x</span><span class="Punctuation">)</span></span></tt> - whitespace and comments (<tt class="docutils literal"><span class="pre"><span class="Comment">#</span></span></tt>) are ignored (<em>extended</em>)</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">?</span><span class="Identifier">X</span><span class="Punctuation">)</span></span></tt> - character escapes without special meaning (<tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">w</span></span></tt> vs. <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">a</span></span></tt>) are errors (<em>extra</em>)</li>
</ul>
<p>One or a combination of these options may appear only at the beginning of the pattern:</p>
<ul class="simple"><li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">UTF8</span><span class="Punctuation">)</span></span></tt> - treat both the pattern and subject as UTF-8</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">UCP</span><span class="Punctuation">)</span></span></tt> - Unicode character properties; <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">w</span></span></tt> matches <tt class="docutils literal"><span class="pre"><span class="Identifier">я</span></span></tt></li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">U</span><span class="Punctuation">)</span></span></tt> - a combination of the two options above</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">FIRSTLINE</span><span class="Operator">*</span><span class="Punctuation">)</span></span></tt> - fails if there is not a match on the first line</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">NO_AUTO_CAPTURE</span><span class="Punctuation">)</span></span></tt> - turn off auto-capture for groups; <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">?&lt;</span><span class="Identifier">name</span><span class="Operator">&gt;...</span><span class="Punctuation">)</span></span></tt> can be used to capture</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">CR</span><span class="Punctuation">)</span></span></tt> - newlines are separated by <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">r</span></span></tt></li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">LF</span><span class="Punctuation">)</span></span></tt> - newlines are separated by <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">n</span></span></tt> (UNIX default)</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">CRLF</span><span class="Punctuation">)</span></span></tt> - newlines are separated by <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">r</span><span class="Operator">\</span><span class="Identifier">n</span></span></tt> (Windows default)</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">ANYCRLF</span><span class="Punctuation">)</span></span></tt> - newlines are separated by any of the above</li>
<li><p><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">ANY</span><span class="Punctuation">)</span></span></tt> - newlines are separated by any of the above and Unicode newlines:</p>
<p>single characters VT (vertical tab, U+000B), FF (form feed, U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and PS (paragraph separator, U+2029). For the 8-bit library, the last two are recognized only in UTF-8 mode. — man pcre</p>
</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">JAVASCRIPT_COMPAT</span><span class="Punctuation">)</span></span></tt> - JavaScript compatibility</li>
<li><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Operator">*</span><span class="Identifier">NO_STUDY</span><span class="Punctuation">)</span></span></tt> - turn off studying; study is enabled by default</li>
</ul>
<p>For more details on the leading option groups, see the <a class="reference external" href="https://man7.org/linux/man-pages/man3/pcresyntax.3.html#OPTION_SETTING">Option Setting</a> and the <a class="reference external" href="https://man7.org/linux/man-pages/man3/pcresyntax.3.html#NEWLINE_CONVENTION">Newline Convention</a> sections of the <a class="reference external" href="https://man7.org/linux/man-pages/man3/pcresyntax.3.html">PCRE syntax manual</a>.</p>
<p>Some of these options are not part of PCRE and are converted by nre into PCRE flags. These include <tt class="docutils literal"><span class="pre"><span class="Identifier">NEVER_UTF</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">ANCHORED</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">DOLLAR_ENDONLY</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">FIRSTLINE</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">NO_AUTO_CAPTURE</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">JAVASCRIPT_COMPAT</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">U</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">NO_STUDY</span></span></tt>. In other PCRE wrappers, you will need to pass these as separate flags to PCRE.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L84" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L84" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RegexDesc">
<dt><pre><a href="nre.html#RegexDesc"><span class="Identifier">RegexDesc</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">pattern</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a>
<span class="Comment">## not nil</span>
<span class="Comment">## nil</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L77" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L77" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RegexError">
<dt><pre><a href="nre.html#RegexError"><span class="Identifier">RegexError</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="system.html#CatchableError"><span class="Identifier">CatchableError</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L201" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L201" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RegexInternalError">
<dt><pre><a href="nre.html#RegexInternalError"><span class="Identifier">RegexInternalError</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="nre.html#RegexError"><span class="Identifier">RegexError</span></a></pre></dt>
<dd>
Internal error in the module, this probably means that there is a bug
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L203" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L203" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RegexMatch">
<dt><pre><a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">pattern</span><span class="Operator">*</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a> <span class="Comment">## The regex doing the matching.</span>
<span class="Comment">## Not nil.</span>
<span class="Identifier">str</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## The string that was matched against.</span>
<span class="Comment">## First item is the bounds of the match</span>
<span class="Comment">## Other items are the captures</span>
<span class="Comment">## `a` is inclusive start, `b` is exclusive end</span></pre></dt>
<dd>
Usually seen as Option<a class="reference internal nimdoc" title="object RegexMatch" href="#RegexMatch">RegexMatch</a>, it represents the result of an execution. On failure, it is none, on success, it is some.<dl class="docutils"><dt><tt class="docutils literal"><span class="pre"><span class="Identifier">pattern</span><span class="Punctuation">:</span> <span class="Identifier">Regex</span></span></tt></dt>
<dd>the pattern that is being matched</dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Identifier">str</span><span class="Punctuation">:</span> <span class="Identifier">string</span></span></tt></dt>
<dd>the string that was matched against</dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Identifier">captures</span><span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Punctuation">:</span> <span class="Identifier">string</span></span></tt></dt>
<dd>the string value of whatever was captured at that id. If the value is invalid, then behavior is undefined. If the id is <tt class="docutils literal"><span class="pre"><span class="Operator">-</span><span class="DecNumber">1</span></span></tt>, then the whole match is returned. If the given capture was not matched, <tt class="docutils literal"><span class="pre"><span class="Keyword">nil</span></span></tt> is returned. See examples for <tt class="docutils literal"><span class="pre"><span class="Identifier">match</span></span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Identifier">captureBounds</span><span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Punctuation">:</span> <span class="Identifier">HSlice</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">,</span> <span class="Identifier">int</span><span class="Punctuation">]</span></span></tt></dt>
<dd>gets the bounds of the given capture according to the same rules as the above. If the capture is not filled, then <tt class="docutils literal"><span class="pre"><span class="Identifier">None</span></span></tt> is returned. The bounds are both inclusive. See examples for <tt class="docutils literal"><span class="pre"><span class="Identifier">match</span></span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Identifier">match</span><span class="Punctuation">:</span> <span class="Identifier">string</span></span></tt></dt>
<dd>the full text of the match.</dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Identifier">matchBounds</span><span class="Punctuation">:</span> <span class="Identifier">HSlice</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">,</span> <span class="Identifier">int</span><span class="Punctuation">]</span></span></tt></dt>
<dd>the bounds of the match, as in <tt class="docutils literal"><span class="pre"><span class="Identifier">captureBounds</span><span class="Punctuation">[</span><span class="Punctuation">]</span></span></tt></dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">captureBounds</span><span class="Operator">|</span><span class="Identifier">captures</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">toTable</span></span></tt></dt>
<dd>returns a table with each named capture as a key.</dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">captureBounds</span><span class="Operator">|</span><span class="Identifier">captures</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">toSeq</span></span></tt></dt>
<dd>returns all the captures by their number.</dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Operator">$:</span> <span class="Identifier">string</span></span></tt></dt>
<dd>same as <tt class="docutils literal"><span class="pre"><span class="Identifier">match</span></span></tt></dd>
</dl>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L156" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L156" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="StudyError">
<dt><pre><a href="nre.html#StudyError"><span class="Identifier">StudyError</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="nre.html#RegexError"><span class="Identifier">RegexError</span></a></pre></dt>
<dd>
Thrown when studying the regular expression fails for whatever reason. The message contains the error code.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L216" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L216" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SyntaxError">
<dt><pre><a href="nre.html#SyntaxError"><span class="Identifier">SyntaxError</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="nre.html#RegexError"><span class="Identifier">RegexError</span></a>
<span class="Identifier">pos</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> <span class="Comment">## the location of the syntax error in bytes</span>
<span class="Identifier">pattern</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## the pattern that caused the problem</span></pre></dt>
<dd>
Thrown when there is a syntax error in the regular expression string passed in
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L210" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L210" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,RegexMatch">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CRegexMatch"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L429" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L429" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="==-procs-all">
<div id="==,Regex,Regex">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CRegex%2CRegex"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L432" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L432" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,RegexMatch,RegexMatch">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CRegexMatch%2CRegexMatch"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L440" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L440" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="[]-procs-all">
<div id="[],CaptureBounds,int">
<dt><pre><span class="Keyword">func</span> <a href="#%5B%5D%2CCaptureBounds%2Cint"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#CaptureBounds"><span class="Identifier">CaptureBounds</span></a><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#HSlice"><span class="Identifier">HSlice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L341" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L341" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="[],CaptureBounds,string">
<dt><pre><span class="Keyword">func</span> <a href="#%5B%5D%2CCaptureBounds%2Cstring"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#CaptureBounds"><span class="Identifier">CaptureBounds</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#HSlice"><span class="Identifier">HSlice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L375" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L375" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="[],Captures,int">
<dt><pre><span class="Keyword">func</span> <a href="#%5B%5D%2CCaptures%2Cint"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Captures"><span class="Identifier">Captures</span></a><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L349" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L349" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="[],Captures,string">
<dt><pre><span class="Keyword">func</span> <a href="#%5B%5D%2CCaptures%2Cstring"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Captures"><span class="Identifier">Captures</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L381" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L381" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="captureBounds-procs-all">
<div id="captureBounds,RegexMatch">
<dt><pre><span class="Keyword">func</span> <a href="#captureBounds%2CRegexMatch"><span class="Identifier">captureBounds</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a><span class="Other">)</span><span class="Other">:</span> <a href="nre.html#CaptureBounds"><span class="Identifier">CaptureBounds</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L330" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L330" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="captureCount-procs-all">
<div id="captureCount,Regex">
<dt><pre><span class="Keyword">proc</span> <a href="#captureCount%2CRegex"><span class="Identifier">captureCount</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L302" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L302" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="captureNameId-procs-all">
<div id="captureNameId,Regex">
<dt><pre><span class="Keyword">proc</span> <a href="#captureNameId%2CRegex"><span class="Identifier">captureNameId</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">)</span><span class="Other">:</span> <a href="tables.html#Table"><span class="Identifier">Table</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L305" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L305" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="captures-procs-all">
<div id="captures,RegexMatch">
<dt><pre><span class="Keyword">func</span> <a href="#captures%2CRegexMatch"><span class="Identifier">captures</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a><span class="Other">)</span><span class="Other">:</span> <a href="nre.html#Captures"><span class="Identifier">Captures</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L332" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L332" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="contains-procs-all">
<div id="contains,CaptureBounds,int">
<dt><pre><span class="Keyword">func</span> <a href="#contains%2CCaptureBounds%2Cint"><span class="Identifier">contains</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#CaptureBounds"><span class="Identifier">CaptureBounds</span></a><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L334" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L334" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="contains,CaptureBounds,string">
<dt><pre><span class="Keyword">func</span> <a href="#contains%2CCaptureBounds%2Cstring"><span class="Identifier">contains</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#CaptureBounds"><span class="Identifier">CaptureBounds</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L361" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L361" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="contains,Captures,int">
<dt><pre><span class="Keyword">func</span> <a href="#contains%2CCaptures%2Cint"><span class="Identifier">contains</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Captures"><span class="Identifier">Captures</span></a><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L338" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L338" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="contains,Captures,string">
<dt><pre><span class="Keyword">func</span> <a href="#contains%2CCaptures%2Cstring"><span class="Identifier">contains</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Captures"><span class="Identifier">Captures</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L368" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L368" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="contains,string,Regex,int">
<dt><pre><span class="Keyword">proc</span> <a href="#contains%2Cstring%2CRegex%2Cint"><span class="Identifier">contains</span></a><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">;</span> <span class="Identifier">start</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">endpos</span> <span class="Other">=</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">.</span><span class="Identifier">high</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">RegexInternalError</span><span class="Other">,</span> <span class="Identifier">InvalidUnicodeError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Determine if the string contains the given pattern between the end and start positions: This function is equivalent to <tt class="docutils literal"><span class="pre"><span class="Identifier">isSome</span><span class="Punctuation">(</span><span class="Identifier">str</span><span class="Operator">.</span><span class="Identifier">find</span><span class="Punctuation">(</span><span class="Identifier">pattern</span><span class="Punctuation">,</span> <span class="Identifier">start</span><span class="Punctuation">,</span> <span class="Identifier">endpos</span><span class="Punctuation">)</span><span class="Punctuation">)</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="StringLit">&quot;abc&quot;</span><span class="Operator">.</span><span class="Identifier">contains</span><span class="Punctuation">(</span><span class="RawData">re&quot;bc&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Keyword">not</span> <span class="StringLit">&quot;abc&quot;</span><span class="Operator">.</span><span class="Identifier">contains</span><span class="Punctuation">(</span><span class="RawData">re&quot;cd&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Keyword">not</span> <span class="StringLit">&quot;abc&quot;</span><span class="Operator">.</span><span class="Identifier">contains</span><span class="Punctuation">(</span><span class="RawData">re&quot;a&quot;</span><span class="Punctuation">,</span> <span class="Identifier">start</span> <span class="Operator">=</span> <span class="DecNumber">1</span><span class="Punctuation">)</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L628" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L628" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="escapeRe-procs-all">
<div id="escapeRe,string">
<dt><pre><span class="Keyword">proc</span> <a href="#escapeRe%2Cstring"><span class="Identifier">escapeRe</span></a><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Escapes the string so it doesn't match any special characters. Incompatible with the Extra flag (<tt class="docutils literal"><span class="pre"><span class="Identifier">X</span></span></tt>).</p>
<p>Escaped char: <tt class="docutils literal"><span class="pre"><span class="Operator">\</span> <span class="Operator">+</span> <span class="Operator">*</span> <span class="Operator">?</span> <span class="Punctuation">[</span> <span class="Operator">^</span> <span class="Punctuation">]</span> <span class="Operator">$</span> <span class="Punctuation">(</span> <span class="Punctuation">)</span> <span class="Punctuation">{</span> <span class="Punctuation">}</span> <span class="Operator">=</span> <span class="Operator">!</span> <span class="Operator">&lt;</span> <span class="Operator">&gt;</span> <span class="Operator">|</span> <span class="Punctuation">:</span> <span class="Operator">-</span></span></tt></p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="Identifier">escapeRe</span><span class="Punctuation">(</span><span class="StringLit">&quot;fly+wind&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;fly</span><span class="EscapeSequence">\\</span><span class="StringLit">+wind&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">escapeRe</span><span class="Punctuation">(</span><span class="StringLit">&quot;!&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;</span><span class="EscapeSequence">\\</span><span class="StringLit">!&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">escapeRe</span><span class="Punctuation">(</span><span class="StringLit">&quot;nim*&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;nim</span><span class="EscapeSequence">\\</span><span class="StringLit">*&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L752" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L752" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="find-procs-all">
<div id="find,string,Regex,int">
<dt><pre><span class="Keyword">proc</span> <a href="#find%2Cstring%2CRegex%2Cint"><span class="Identifier">find</span></a><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">;</span> <span class="Identifier">start</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">endpos</span> <span class="Other">=</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">.</span><span class="Identifier">high</span><span class="Other">)</span><span class="Other">:</span> <a href="options.html#Option"><span class="Identifier">Option</span></a><span class="Other">[</span>
<a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">RegexInternalError</span><span class="Other">,</span> <span class="Identifier">InvalidUnicodeError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Finds the given pattern in the string between the end and start positions.<dl class="docutils"><dt><tt class="docutils literal"><span class="pre"><span class="Identifier">start</span></span></tt></dt>
<dd>The start point at which to start matching. <tt class="docutils literal"><span class="pre"><span class="Operator">|</span><span class="Identifier">abc</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt>; <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span><span class="Operator">|</span><span class="Identifier">bc</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt></dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Identifier">endpos</span></span></tt></dt>
<dd>The maximum index for a match; <tt class="docutils literal"><span class="pre"><span class="Identifier">int</span><span class="Operator">.</span><span class="Identifier">high</span></span></tt> means the end of the string, otherwise its an inclusive upper bound.</dd>
</dl>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L610" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L610" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="findAll-procs-all">
<div id="findAll,string,Regex,int">
<dt><pre><span class="Keyword">proc</span> <a href="#findAll%2Cstring%2CRegex%2Cint"><span class="Identifier">findAll</span></a><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">;</span> <span class="Identifier">start</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">endpos</span> <span class="Other">=</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">.</span><span class="Identifier">high</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span>
<a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">RegexInternalError</span><span class="Other">,</span> <span class="Identifier">InvalidUnicodeError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L623" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L623" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="match-procs-all">
<div id="match,RegexMatch">
<dt><pre><span class="Keyword">func</span> <a href="#match%2CRegexMatch"><span class="Identifier">match</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L355" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L355" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="match,string,Regex,int">
<dt><pre><span class="Keyword">proc</span> <a href="#match%2Cstring%2CRegex%2Cint"><span class="Identifier">match</span></a><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">;</span> <span class="Identifier">start</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">endpos</span> <span class="Other">=</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">.</span><span class="Identifier">high</span><span class="Other">)</span><span class="Other">:</span> <a href="options.html#Option"><span class="Identifier">Option</span></a><span class="Other">[</span>
<a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">RegexInternalError</span><span class="Other">,</span> <span class="Identifier">InvalidUnicodeError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Like <a class="reference external" href="#find,string,Regex,int">find(...)</a>, but anchored to the start of the string.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="StringLit">&quot;foo&quot;</span><span class="Operator">.</span><span class="Identifier">match</span><span class="Punctuation">(</span><span class="RawData">re&quot;f&quot;</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">isSome</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;foo&quot;</span><span class="Operator">.</span><span class="Identifier">match</span><span class="Punctuation">(</span><span class="RawData">re&quot;o&quot;</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">isNone</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;abc&quot;</span><span class="Operator">.</span><span class="Identifier">match</span><span class="Punctuation">(</span><span class="RawData">re&quot;(\w)&quot;</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">get</span><span class="Operator">.</span><span class="Identifier">captures</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;a&quot;</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;abc&quot;</span><span class="Operator">.</span><span class="Identifier">match</span><span class="Punctuation">(</span><span class="RawData">re&quot;(?&lt;letter&gt;\w)&quot;</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">get</span><span class="Operator">.</span><span class="Identifier">captures</span><span class="Punctuation">[</span><span class="StringLit">&quot;letter&quot;</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;a&quot;</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;abc&quot;</span><span class="Operator">.</span><span class="Identifier">match</span><span class="Punctuation">(</span><span class="RawData">re&quot;(\w)\w&quot;</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">get</span><span class="Operator">.</span><span class="Identifier">captures</span><span class="Punctuation">[</span><span class="Operator">-</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;ab&quot;</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;abc&quot;</span><span class="Operator">.</span><span class="Identifier">match</span><span class="Punctuation">(</span><span class="RawData">re&quot;(\w)&quot;</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">get</span><span class="Operator">.</span><span class="Identifier">captureBounds</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="DecNumber">0</span> <span class="Operator">..</span> <span class="DecNumber">0</span>
<span class="Identifier">assert</span> <span class="DecNumber">0</span> <span class="Keyword">in</span> <span class="StringLit">&quot;abc&quot;</span><span class="Operator">.</span><span class="Identifier">match</span><span class="Punctuation">(</span><span class="RawData">re&quot;(\w)&quot;</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">get</span><span class="Operator">.</span><span class="Identifier">captureBounds</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;abc&quot;</span><span class="Operator">.</span><span class="Identifier">match</span><span class="Punctuation">(</span><span class="RawData">re&quot;&quot;</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">get</span><span class="Operator">.</span><span class="Identifier">captureBounds</span><span class="Punctuation">[</span><span class="Operator">-</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="DecNumber">0</span> <span class="Operator">..</span> <span class="Operator">-</span><span class="DecNumber">1</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;abc&quot;</span><span class="Operator">.</span><span class="Identifier">match</span><span class="Punctuation">(</span><span class="RawData">re&quot;abc&quot;</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">get</span><span class="Operator">.</span><span class="Identifier">captureBounds</span><span class="Punctuation">[</span><span class="Operator">-</span><span class="DecNumber">1</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="DecNumber">0</span> <span class="Operator">..</span> <span class="DecNumber">2</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L542" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L542" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="matchBounds-procs-all">
<div id="matchBounds,RegexMatch">
<dt><pre><span class="Keyword">func</span> <a href="#matchBounds%2CRegexMatch"><span class="Identifier">matchBounds</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#HSlice"><span class="Identifier">HSlice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L358" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L358" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="re-procs-all">
<div id="re,string">
<dt><pre><span class="Keyword">proc</span> <a href="#re%2Cstring"><span class="Identifier">re</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">SyntaxError</span><span class="Other">,</span> <span class="Identifier">StudyError</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L499" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L499" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="replace-procs-all">
<div id="replace,string,Regex,string">
<dt><pre><span class="Keyword">proc</span> <a href="#replace%2Cstring%2CRegex%2Cstring"><span class="Identifier">replace</span></a><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">;</span> <span class="Identifier">sub</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">RegexInternalError</span><span class="Other">,</span> <span class="Identifier">InvalidUnicodeError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L747" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L747" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="replace,string,Regex,proc(RegexMatch)">
<dt><pre><span class="Keyword">proc</span> <a href="#replace%2Cstring%2CRegex%2Cproc%28RegexMatch%29"><span class="Identifier">replace</span></a><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">;</span>
<span class="Identifier">subproc</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">match</span><span class="Other">:</span> <a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">RegexInternalError</span><span class="Other">,</span> <span class="Identifier">InvalidUnicodeError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Replaces each match of Regex in the string with <tt class="docutils literal"><span class="pre"><span class="Identifier">subproc</span></span></tt>, which should never be or return <tt class="docutils literal"><span class="pre"><span class="Keyword">nil</span></span></tt>.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">subproc</span></span></tt> is a <tt class="docutils literal"><span class="pre"><span class="Keyword">proc</span> <span class="Punctuation">(</span><span class="Identifier">RegexMatch</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">string</span></span></tt>, then it is executed with each match and the return value is the replacement value.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">subproc</span></span></tt> is a <tt class="docutils literal"><span class="pre"><span class="Keyword">proc</span> <span class="Punctuation">(</span><span class="Identifier">string</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">string</span></span></tt>, then it is executed with the full text of the match and the return value is the replacement value.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">subproc</span></span></tt> is a string, the syntax is as follows:</p>
<ul class="simple"><li><tt class="docutils literal"><span class="pre"><span class="Operator">$$</span></span></tt> - literal <tt class="docutils literal"><span class="pre"><span class="Operator">$</span></span></tt></li>
<li><tt class="docutils literal"><span class="pre"><span class="Operator">$</span><span class="DecNumber">123</span></span></tt> - capture number <tt class="docutils literal"><span class="pre"><span class="DecNumber">123</span></span></tt></li>
<li><tt class="docutils literal"><span class="pre"><span class="Operator">$</span><span class="Identifier">foo</span></span></tt> - named capture <tt class="docutils literal"><span class="pre"><span class="Identifier">foo</span></span></tt></li>
<li><tt class="docutils literal"><span class="pre"><span class="Operator">$</span><span class="Punctuation">{</span><span class="Identifier">foo</span><span class="Punctuation">}</span></span></tt> - same as above</li>
<li><tt class="docutils literal"><span class="pre"><span class="Operator">$</span><span class="DecNumber">1</span><span class="Operator">$</span><span class="Comment">#</span></span></tt> - first and second captures</li>
<li><tt class="docutils literal"><span class="pre"><span class="Operator">$</span><span class="Comment">#</span></span></tt> - first capture</li>
<li><tt class="docutils literal"><span class="pre"><span class="Operator">$</span><span class="DecNumber">0</span></span></tt> - full match</li>
</ul>
<p>If a given capture is missing, <tt class="docutils literal"><span class="pre"><span class="Identifier">IndexDefect</span></span></tt> thrown for un-named captures and <tt class="docutils literal"><span class="pre"><span class="Identifier">KeyError</span></span></tt> for named captures.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L718" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L718" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="replace,string,Regex,proc(string)">
<dt><pre><span class="Keyword">proc</span> <a href="#replace%2Cstring%2CRegex%2Cproc%28string%29"><span class="Identifier">replace</span></a><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">;</span> <span class="Identifier">subproc</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">match</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">RegexInternalError</span><span class="Other">,</span> <span class="Identifier">InvalidUnicodeError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L743" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L743" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="split-procs-all">
<div id="split,string,Regex,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#split%2Cstring%2CRegex%2Cint%2Cint"><span class="Identifier">split</span></a><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">;</span> <span class="Identifier">maxSplit</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">;</span> <span class="Identifier">start</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">RegexInternalError</span><span class="Other">,</span> <span class="Identifier">InvalidUnicodeError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Splits the string with the given regex. This works according to the rules that Perl and Javascript use.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">start</span></span></tt> behaves the same as in <a class="reference external" href="#find,string,Regex,int">find(...)</a>. </p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Comment"># - If the match is zero-width, then the string is still split:</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;123&quot;</span><span class="Operator">.</span><span class="Identifier">split</span><span class="Punctuation">(</span><span class="RawData">re&quot;&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;2&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;3&quot;</span><span class="Punctuation">]</span>
<span class="Comment"># - If the pattern has a capture in it, it is added after the string</span>
<span class="Comment"># split:</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;12&quot;</span><span class="Operator">.</span><span class="Identifier">split</span><span class="Punctuation">(</span><span class="RawData">re&quot;(\d)&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;2&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;&quot;</span><span class="Punctuation">]</span>
<span class="Comment"># - If `maxsplit != -1`, then the string will only be split</span>
<span class="Comment"># `maxsplit - 1` times. This means that there will be `maxsplit`</span>
<span class="Comment"># strings in the output seq.</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;1.2.3&quot;</span><span class="Operator">.</span><span class="Identifier">split</span><span class="Punctuation">(</span><span class="RawData">re&quot;\.&quot;</span><span class="Punctuation">,</span> <span class="Identifier">maxsplit</span> <span class="Operator">=</span> <span class="DecNumber">2</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;1&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;2.3&quot;</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L639" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L639" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toSeq-procs-all">
<div id="toSeq,CaptureBounds">
<dt><pre><span class="Keyword">proc</span> <a href="#toSeq%2CCaptureBounds"><span class="Identifier">toSeq</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#CaptureBounds"><span class="Identifier">CaptureBounds</span></a><span class="Other">;</span> <span class="Identifier">default</span> <span class="Other">=</span> <span class="Identifier">none</span><span class="Other">(</span><a href="system.html#HSlice"><span class="Identifier">HSlice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span>
<a href="options.html#Option"><span class="Identifier">Option</span></a><span class="Other">[</span><a href="system.html#HSlice"><span class="Identifier">HSlice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">]</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L419" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L419" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="toSeq,Captures,Option[string]">
<dt><pre><span class="Keyword">proc</span> <a href="#toSeq%2CCaptures%2COption%5Bstring%5D"><span class="Identifier">toSeq</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Captures"><span class="Identifier">Captures</span></a><span class="Other">;</span> <span class="Identifier">default</span><span class="Other">:</span> <a href="options.html#Option"><span class="Identifier">Option</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">none</span><span class="Other">(</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span>
<a href="options.html#Option"><span class="Identifier">Option</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L424" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L424" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toTable-procs-all">
<div id="toTable,CaptureBounds">
<dt><pre><span class="Keyword">func</span> <a href="#toTable%2CCaptureBounds"><span class="Identifier">toTable</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#CaptureBounds"><span class="Identifier">CaptureBounds</span></a><span class="Other">)</span><span class="Other">:</span> <a href="tables.html#Table"><span class="Identifier">Table</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">,</span> <a href="system.html#HSlice"><span class="Identifier">HSlice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L396" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L396" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="toTable,Captures">
<dt><pre><span class="Keyword">func</span> <a href="#toTable%2CCaptures"><span class="Identifier">toTable</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Captures"><span class="Identifier">Captures</span></a><span class="Other">)</span><span class="Other">:</span> <a href="tables.html#Table"><span class="Identifier">Table</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">,</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L392" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L392" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="findIter-iterators-all">
<div id="findIter.i,string,Regex,int">
<dt><pre><span class="Keyword">iterator</span> <a href="#findIter.i%2Cstring%2CRegex%2Cint"><span class="Identifier">findIter</span></a><span class="Other">(</span><span class="Identifier">str</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Regex"><span class="Identifier">Regex</span></a><span class="Other">;</span> <span class="Identifier">start</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">endpos</span> <span class="Other">=</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">.</span><span class="Identifier">high</span><span class="Other">)</span><span class="Other">:</span> <a href="nre.html#RegexMatch"><span class="Identifier">RegexMatch</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">RegexInternalError</span><span class="Other">,</span> <span class="Identifier">InvalidUnicodeError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Works the same as <a class="reference external" href="#find,string,Regex,int">find(...)</a>, but finds every non-overlapping match:
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">sugar</span>
<span class="Identifier">assert</span> <span class="Identifier">collect</span><span class="Punctuation">(</span><span class="Keyword">for</span> <span class="Identifier">a</span> <span class="Keyword">in</span> <span class="StringLit">&quot;2222&quot;</span><span class="Operator">.</span><span class="Identifier">findIter</span><span class="Punctuation">(</span><span class="RawData">re&quot;22&quot;</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">match</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;22&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;22&quot;</span><span class="Punctuation">]</span>
<span class="Comment"># not @[&quot;22&quot;, &quot;22&quot;, &quot;22&quot;]</span></pre><p>Arguments are the same as <a class="reference external" href="#find,string,Regex,int">find(...)</a></p>
<p>Variants:</p>
<ul class="simple"><li><tt class="docutils literal"><span class="pre"><span class="Keyword">proc</span> <span class="Identifier">findAll</span><span class="Punctuation">(</span><span class="Operator">...</span><span class="Punctuation">)</span></span></tt> returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span></span></tt></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L559" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L559" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="items-iterators-all">
<div id="items.i,CaptureBounds">
<dt><pre><span class="Keyword">iterator</span> <a href="#items.i%2CCaptureBounds"><span class="Identifier">items</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#CaptureBounds"><span class="Identifier">CaptureBounds</span></a><span class="Other">;</span> <span class="Identifier">default</span> <span class="Other">=</span> <span class="Identifier">none</span><span class="Other">(</span><a href="system.html#HSlice"><span class="Identifier">HSlice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="options.html#Option"><span class="Identifier">Option</span></a><span class="Other">[</span>
<a href="system.html#HSlice"><span class="Identifier">HSlice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L411" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L411" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="items.i,Captures,Option[string]">
<dt><pre><span class="Keyword">iterator</span> <a href="#items.i%2CCaptures%2COption%5Bstring%5D"><span class="Identifier">items</span></a><span class="Other">(</span><span class="Identifier">pattern</span><span class="Other">:</span> <a href="nre.html#Captures"><span class="Identifier">Captures</span></a><span class="Other">;</span> <span class="Identifier">default</span><span class="Other">:</span> <a href="options.html#Option"><span class="Identifier">Option</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">none</span><span class="Other">(</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="options.html#Option"><span class="Identifier">Option</span></a><span class="Other">[</span>
<a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/impure/nre.nim#L415" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/impure/nre.nim#L415" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
<a href="options.html#$,Option[T]"><span class="Identifier">$</span></a>, <a href="options.html#none"><span class="Identifier">none</span></a>, <a href="options.html#flatten,Option[Option[T]]"><span class="Identifier">flatten</span></a>, <a href="options.html#none,typedesc"><span class="Identifier">none</span></a>, <a href="options.html#==,Option[T],Option[T]"><span class="Identifier">==</span></a>, <a href="options.html#get,Option[T]"><span class="Identifier">get</span></a>, <a href="options.html#map,Option[T],proc(T)"><span class="Identifier">map</span></a>, <a href="options.html#get,Option[T]_2"><span class="Identifier">get</span></a>, <a href="options.html#map,Option[T],proc(T)_2"><span class="Identifier">map</span></a>, <a href="options.html#UnpackDefect"><span class="Identifier">UnpackDefect</span></a>, <a href="options.html#Option"><span class="Identifier">Option</span></a>, <a href="options.html#get,Option[T],T"><span class="Identifier">get</span></a>, <a href="options.html#unsafeGet,Option[T]"><span class="Identifier">unsafeGet</span></a>, <a href="options.html#option,sinkT"><span class="Identifier">option</span></a>, <a href="options.html#UnpackError"><span class="Identifier">UnpackError</span></a>, <a href="options.html#flatMap,Option[T],proc(T)"><span class="Identifier">flatMap</span></a>, <a href="options.html#isSome,Option[T]"><span class="Identifier">isSome</span></a>, <a href="options.html#some,sinkT"><span class="Identifier">some</span></a>, <a href="options.html#filter,Option[T],proc(T)"><span class="Identifier">filter</span></a>, <a href="options.html#isNone,Option[T]"><span class="Identifier">isNone</span></a>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-09-27 04:01:46 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>