/usr/share/doc/libghc-pcre-light-doc/html/Text-Regex-PCRE-Light-Char8.html is in libghc-pcre-light-doc 0.4.0.4-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Regex.PCRE.Light.Char8</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Text-Regex-PCRE-Light-Char8.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text-Regex-PCRE-Light-Char8.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">pcre-light-0.4.0.4: Portable regex library for Perl 5 compatible regular expressions</p></div><div id="content"><div id="module-header"><table class="info"><tr><th valign="top">Copyright</th><td>Copyright (c) 2007-2008 Don Stewart</td></tr><tr><th>License</th><td>BSD3</td></tr><tr><th>Maintainer</th><td>Don Stewart <dons@galois.com></td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Portability</th><td>H98 + FFI</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Text.Regex.PCRE.Light.Char8</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">The abstract PCRE Regex type</a></li><li><a href="#g:2">String interface</a></li><li><a href="#g:3">Regex types and constructors externally visible</a><ul><li><a href="#g:4">PCRE compile-time bit flags</a></li><li><a href="#g:5">PCRE exec-time bit flags</a></li></ul></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc empty"> </div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Regex">Regex</a></li><li class="src short"><a href="#v:compile">compile</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -> [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a>] -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a></li><li class="src short"><a href="#v:compileM">compileM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -> [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a></li><li class="src short"><a href="#v:match">match</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -> [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a>]</li><li class="src short"><span class="keyword">data</span> <a href="#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:anchored">anchored</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:auto_callout">auto_callout</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:caseless">caseless</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:dollar_endonly">dollar_endonly</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:dotall">dotall</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:dupnames">dupnames</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:extended">extended</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:extra">extra</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:firstline">firstline</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:multiline">multiline</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:newline_cr">newline_cr</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:newline_crlf">newline_crlf</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:newline_lf">newline_lf</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:no_auto_capture">no_auto_capture</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:ungreedy">ungreedy</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:utf8">utf8</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><a href="#v:no_utf8_check">no_utf8_check</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:PCREExecOption">PCREExecOption</a></li><li class="src short"><a href="#v:exec_anchored">exec_anchored</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></li><li class="src short"><a href="#v:exec_newline_cr">exec_newline_cr</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></li><li class="src short"><a href="#v:exec_newline_crlf">exec_newline_crlf</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></li><li class="src short"><a href="#v:exec_newline_lf">exec_newline_lf</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></li><li class="src short"><a href="#v:exec_notbol">exec_notbol</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></li><li class="src short"><a href="#v:exec_noteol">exec_noteol</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></li><li class="src short"><a href="#v:exec_notempty">exec_notempty</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></li><li class="src short"><a href="#v:exec_no_utf8_check">exec_no_utf8_check</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></li><li class="src short"><a href="#v:exec_partial">exec_partial</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></li></ul></div><div id="interface"><h1 id="g:1">The abstract PCRE Regex type</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Regex" class="def">Regex</a> <a href="src/Text-Regex-PCRE-Light-Base.html#Regex" class="link">Source</a> <a href="#t:Regex" class="selflink">#</a></p><div class="doc"><p>An abstract pointer to a compiled PCRE Regex structure
The structure allocated by the PCRE library will be deallocated
automatically by the Haskell storage manager.</p></div><div class="subs instances"><p id="control.i:Regex" class="caption collapser" onclick="toggleSection('i:Regex')">Instances</p><div id="section.i:Regex" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Regex:Eq:1" class="instance expander" onclick="toggleSection('i:id:Regex:Eq:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-118" class="link">Source</a> <a href="#t:Regex" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Regex:Eq:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Regex:Ord:2" class="instance expander" onclick="toggleSection('i:id:Regex:Ord:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-118" class="link">Source</a> <a href="#t:Regex" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Regex:Ord:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:compare">compare</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ordering">Ordering</a> <a href="#v:compare" class="selflink">#</a></p><p class="src"><a href="#v:-60-">(<)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60-" class="selflink">#</a></p><p class="src"><a href="#v:-60--61-">(<=)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62-">(>)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62-" class="selflink">#</a></p><p class="src"><a href="#v:-62--61-">(>=)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62--61-" class="selflink">#</a></p><p class="src"><a href="#v:max">max</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> <a href="#v:max" class="selflink">#</a></p><p class="src"><a href="#v:min">min</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> <a href="#v:min" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Regex:Show:3" class="instance expander" onclick="toggleSection('i:id:Regex:Show:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-118" class="link">Source</a> <a href="#t:Regex" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Regex:Show:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><h1 id="g:2">String interface</h1><div class="top"><p class="src"><a id="v:compile" class="def">compile</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -> [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a>] -> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> <a href="src/Text-Regex-PCRE-Light-Char8.html#compile" class="link">Source</a> <a href="#v:compile" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:compile">compile</a></code></p><p>Compile a perl-compatible regular expression, in a strict bytestring.
The arguments are:</p><ul><li><code>pat</code>: A ByteString, which may or may not be zero-terminated,
containing the regular expression to be compiled. </li><li><code>flags</code>, optional bit flags. If <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#v:Nothing">Nothing</a></code> is provided, defaults are used.</li></ul><p>Valid compile-time flags are:</p><ul><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:anchored">anchored</a></code> - Force pattern anchoring</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:auto_callout">auto_callout</a></code> - Compile automatic callouts</li><li><code>bsr_anycrlf</code> - \R matches only CR, LF, or CRLF</li><li><code>bsr_unicode</code> - \R matches all Unicode line endings</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:caseless">caseless</a></code> - Do caseless matching</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:dollar_endonly">dollar_endonly</a></code> - <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Function.html#v:-36-">$</a></code> not to match newline at end</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:dotall">dotall</a></code> - matches anything including NL</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:dupnames">dupnames</a></code> - Allow duplicate names for subpatterns</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:extended">extended</a></code> - Ignore whitespace and # comments</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:extra">extra</a></code> - PCRE extra features (not much use currently)</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:firstline">firstline</a></code> - Force matching to be before newline</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:multiline">multiline</a></code> - <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#v:-94-">^</a></code> and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Function.html#v:-36-">$</a></code> match newlines within data</li><li><code>newline_any</code> - Recognize any Unicode newline sequence</li><li><code>newline_anycrlf</code> - Recognize CR, LF, and CRLF as newline sequences</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_cr">newline_cr</a></code> - Set CR as the newline sequence</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_crlf">newline_crlf</a></code> - Set CRLF as the newline sequence</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_lf">newline_lf</a></code> - Set LF as the newline sequence</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:no_auto_capture">no_auto_capture</a></code> - Disable numbered capturing parentheses (named ones available)</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:ungreedy">ungreedy</a></code> - Invert greediness of quantifiers</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:utf8">utf8</a></code> - Run in UTF-8 mode</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:no_utf8_check">no_utf8_check</a></code> - Do not check the pattern for UTF-8 validity</li></ul><p>If compilation of the pattern fails, the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#v:Left">Left</a></code> constructor is
returned with the error string. Otherwise an abstract type
representing the compiled regular expression is returned.
The regex is allocated via malloc on the C side, and will be
deallocated by the runtime when the Haskell value representing it
goes out of scope.</p><p>As regexes are often defined statically, GHC will compile them
to null-terminated, strict C strings, enabling compilation of the
pattern without copying. This may be useful for very large patterns.</p><p>See man pcreapi for more details.</p></div></div><div class="top"><p class="src"><a id="v:compileM" class="def">compileM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -> [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> <a href="src/Text-Regex-PCRE-Light-Char8.html#compileM" class="link">Source</a> <a href="#v:compileM" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:compileM">compileM</a></code>
A safe version of <code><a href="Text-Regex-PCRE-Light-Char8.html#v:compile">compile</a></code> with failure lifted into an Either</p></div></div><div class="top"><p class="src"><a id="v:match" class="def">match</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:Regex">Regex</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -> [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a>] <a href="src/Text-Regex-PCRE-Light-Char8.html#match" class="link">Source</a> <a href="#v:match" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:match">match</a></code></p><p>Matches a compiled regular expression against a given subject string,
using a matching algorithm that is similar to Perl's. If the subject
string doesn't match the regular expression, <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#v:Nothing">Nothing</a></code> is returned,
otherwise the portion of the string that matched is returned, along
with any captured subpatterns.</p><p>The arguments are:</p><ul><li><code>regex</code>, a PCRE regular expression value produced by compile</li><li><code>subject</code>, the subject string to match against</li><li><code>options</code>, an optional set of exec-time flags to exec.</li></ul><p>Available runtime options are:</p><ul><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:anchored">anchored</a></code> - Match only at the first position</li><li><code>bsr_anycrlf</code> - '\\R' matches only CR, LF, or CRLF</li><li><code>bsr_unicode</code> - '\\R' matches all Unicode line endings</li><li><code>newline_any</code> - Recognize any Unicode newline sequence</li><li><code>newline_anycrlf</code> - Recognize CR, LF, and CRLF as newline sequences</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_cr">newline_cr</a></code> - Set CR as the newline sequence</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_crlf">newline_crlf</a></code> - Set CRLF as the newline sequence</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_lf">newline_lf</a></code> - Set LF as the newline sequence</li><li><code>notbol</code> - Subject is not the beginning of a line</li><li><code>noteol</code> - Subject is not the end of a line</li><li><code>notempty</code> - An empty string is not a valid match</li><li><code><a href="Text-Regex-PCRE-Light-Char8.html#v:no_utf8_check">no_utf8_check</a></code> - Do not check the subject for UTF-8</li><li><code>partial</code> - Return PCRE_ERROR_PARTIAL for a partial match</li></ul><p>The result value, and any captured subpatterns, are returned.
If the regex is invalid, or the subject string is empty, Nothing
is returned.</p></div></div><h1 id="g:3">Regex types and constructors externally visible</h1><h2 id="g:4">PCRE compile-time bit flags</h2><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:PCREOption" class="def">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#PCREOption" class="link">Source</a> <a href="#t:PCREOption" class="selflink">#</a></p><div class="doc"><p>A type for PCRE compile-time options. These are newtyped CInts,
which can be bitwise-or'd together, using '(Data.Bits..|.)'</p></div><div class="subs instances"><p id="control.i:PCREOption" class="caption collapser" onclick="toggleSection('i:PCREOption')">Instances</p><div id="section.i:PCREOption" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PCREOption:Eq:1" class="instance expander" onclick="toggleSection('i:id:PCREOption:Eq:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-129" class="link">Source</a> <a href="#t:PCREOption" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:PCREOption:Eq:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PCREOption:Ord:2" class="instance expander" onclick="toggleSection('i:id:PCREOption:Ord:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-129" class="link">Source</a> <a href="#t:PCREOption" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:PCREOption:Ord:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:compare">compare</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ordering">Ordering</a> <a href="#v:compare" class="selflink">#</a></p><p class="src"><a href="#v:-60-">(<)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60-" class="selflink">#</a></p><p class="src"><a href="#v:-60--61-">(<=)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62-">(>)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62-" class="selflink">#</a></p><p class="src"><a href="#v:-62--61-">(>=)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62--61-" class="selflink">#</a></p><p class="src"><a href="#v:max">max</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="#v:max" class="selflink">#</a></p><p class="src"><a href="#v:min">min</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="#v:min" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PCREOption:Read:3" class="instance expander" onclick="toggleSection('i:id:PCREOption:Read:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-129" class="link">Source</a> <a href="#t:PCREOption" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:PCREOption:Read:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:readsPrec">readsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="#v:readsPrec" class="selflink">#</a></p><p class="src"><a href="#v:readList">readList</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a>] <a href="#v:readList" class="selflink">#</a></p><p class="src"><a href="#v:readPrec">readPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="#v:readPrec" class="selflink">#</a></p><p class="src"><a href="#v:readListPrec">readListPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a>] <a href="#v:readListPrec" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PCREOption:Show:4" class="instance expander" onclick="toggleSection('i:id:PCREOption:Show:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-129" class="link">Source</a> <a href="#t:PCREOption" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:PCREOption:Show:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:anchored" class="def">anchored</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#anchored" class="link">Source</a> <a href="#v:anchored" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:anchored">anchored</a></code></p><p>If this bit is set, the pattern is forced to be <em>anchored</em>, that is,
it is constrained to match only at the first matching point in the
string that is being searched (the <em>subject string</em>). This effect can
also be achieved by appropriate constructs in the pattern itself, which
is the only way to do it in Perl. </p></div></div><div class="top"><p class="src"><a id="v:auto_callout" class="def">auto_callout</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#auto_callout" class="link">Source</a> <a href="#v:auto_callout" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:auto_callout">auto_callout</a></code></p><p>If this bit is set, "compile" automatically inserts callout
items, all with number 255, before each pattern item. For discussion
of the callout facility, see the man pcrecallout documentation</p></div></div><div class="top"><p class="src"><a id="v:caseless" class="def">caseless</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#caseless" class="link">Source</a> <a href="#v:caseless" class="selflink">#</a></p><div class="doc"><p><code>bsr_anycrlf</code> and <code>bsr_unicode</code></p><p>These options (which are mutually exclusive) control what the \R escape
sequence matches. The choice is either to match only CR, LF, or CRLF, or to
match any Unicode new- line sequence. The default is specified when PCRE is
built. It can be overridden from within the pattern, or by setting an option
when a compiled pattern is matched.</p><p>bsr_anycrlf :: PCREOption
bsr_anycrlf = PCREOption bsr_anycrlf_cint</p><p><code>bsr_unicode</code>. See <code>bse_anycrlf</code></p><p>bsr_unicode :: PCREOption
bsr_unicode = PCREOption bsr_unicode_cint</p><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:caseless">caseless</a></code></p><p>If this bit is set, letters in the pattern match both upper and lower case
letters. It is equivalent to Perl's /i option, and it can be changed within a
pattern by a (?i) option setting. In UTF-8 mode, PCRE always understands the
concept of case for characters whose values are less than 128, so caseless
matching is always possible. For characters with higher values, the concept of
case is supported if PCRE is compiled with Unicode property sup- port, but not
otherwise. If you want to use caseless matching for characters 128 and above,
you must ensure that PCRE is compiled with Unicode property support as well as
with UTF-8 support.</p></div></div><div class="top"><p class="src"><a id="v:dollar_endonly" class="def">dollar_endonly</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#dollar_endonly" class="link">Source</a> <a href="#v:dollar_endonly" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:dollar_endonly">dollar_endonly</a></code></p><p>If this bit is set, a dollar metacharacter in the pattern matches only at
the end of the subject string. Without this option, a dollar also matches
immediately before a newline at the end of the string (but not before any other
newlines). The <code><a href="Text-Regex-PCRE-Light-Char8.html#v:dollar_endonly">dollar_endonly</a></code> option is ignored if <code><a href="Text-Regex-PCRE-Light-Char8.html#v:multiline">multiline</a></code>
is set. There is no equivalent to this option in Perl, and no way to set it
within a pattern.</p></div></div><div class="top"><p class="src"><a id="v:dotall" class="def">dotall</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#dotall" class="link">Source</a> <a href="#v:dotall" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:dotall">dotall</a></code></p><p>If this bit is set, a dot metacharater in the pattern matches all
characters, including those that indicate newline. Without it, a dot does
not match when the current position is at a newline. This option is
equivalent to Perl's /s option, and it can be changed within a pattern by a
(?s) option setting. A negative class such as [^a] always matches newline
characters, independent of the setting of this option.</p></div></div><div class="top"><p class="src"><a id="v:dupnames" class="def">dupnames</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#dupnames" class="link">Source</a> <a href="#v:dupnames" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:dupnames">dupnames</a></code></p><p>If this bit is set, names used to identify capturing subpatterns need not be
unique. This can be helpful for certain types of pattern when it is known
that only one instance of the named subpattern can ever be matched. There are
more details of named subpatterns in the <em>man pcreapi</em> documentation.</p></div></div><div class="top"><p class="src"><a id="v:extended" class="def">extended</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#extended" class="link">Source</a> <a href="#v:extended" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:extended">extended</a></code></p><p>If this bit is set, whitespace data characters in the pattern are totally
ignored except when escaped or inside a character class. Whitespace does not
include the VT character (code 11). In addition, characters between an
unescaped # outside a character class and the next newline, inclusive, are
also ignored. This is equivalent to Perl's /x option, and it can be changed
within a pattern by a (?x) option setting.</p><p>This option makes it possible to include comments inside complicated
patterns. Note, however, that this applies only to data characters. Whitespace
characters may never appear within special character sequences in a pattern,
for example within the sequence (?( which introduces a conditional subpattern.</p></div></div><div class="top"><p class="src"><a id="v:extra" class="def">extra</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#extra" class="link">Source</a> <a href="#v:extra" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:extra">extra</a></code></p><p>This option was invented in order to turn on additional functionality of
PCRE that is incompatible with Perl, but it is currently of very little use.
When set, any backslash in a pattern that is followed by a letter that has no
special meaning causes an error, thus reserving these combinations for future
expansion. By default, as in Perl, a backslash followed by a letter with no
special meaning is treated as a literal. (Perl can, however, be persuaded to
give a warning for this.) There are at present no other features controlled by
this option. It can also be set by a (?X) option setting within a pattern. </p></div></div><div class="top"><p class="src"><a id="v:firstline" class="def">firstline</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#firstline" class="link">Source</a> <a href="#v:firstline" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:firstline">firstline</a></code></p><p>If this option is set, an unanchored pattern is required to match before or
at the first newline in the subject string, though the matched text may
continue over the newline.</p></div></div><div class="top"><p class="src"><a id="v:multiline" class="def">multiline</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#multiline" class="link">Source</a> <a href="#v:multiline" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:multiline">multiline</a></code></p><p>By default, PCRE treats the subject string as consisting of a single line
of characters (even if it actually contains newlines). The <em>start of line</em>
metacharacter (^) matches only at the start of the string, while the <em>end of line</em>
metacharacter ($) matches only at the end of the string, or before a
terminating newline (unless <code><a href="Text-Regex-PCRE-Light-Char8.html#v:dollar_endonly">dollar_endonly</a></code> is set). This is the same
as Perl.</p><p>When <code><a href="Text-Regex-PCRE-Light-Char8.html#v:multiline">multiline</a></code> it is set, the <em>start of line</em> and <em>end of line</em>
constructs match immediately following or immediately before internal newlines
in the subject string, respectively, as well as at the very start and end. This
is equivalent to Perl's /m option, and it can be changed within a pattern by a
(?m) option setting. If there are no newlines in a subject string, or no occur-
rences of ^ or $ in a pattern, setting PCRE_MULTILINE has no effect.</p></div></div><div class="top"><p class="src"><a id="v:newline_cr" class="def">newline_cr</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#newline_cr" class="link">Source</a> <a href="#v:newline_cr" class="selflink">#</a></p><div class="doc"><p>newline_cr', <code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_lf">newline_lf</a></code>, <code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_crlf">newline_crlf</a></code>,
<code>newline_anycrlf</code>, <code>newline_any</code></p><p>These options override the default newline definition that
was chosen when PCRE was built. Setting the first or the
second specifies that a newline is indicated by a single
character (CR or LF, respectively). Setting <code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_crlf">newline_crlf</a></code> specifies
that a newline is indicated by the two-character CRLF sequence.
Setting <code>newline_anycrlf</code>
specifies that any of the three preceding sequences should
be recognized. Setting <code>newline_any</code> specifies that any
Unicode newline sequence should be recognized. The Unicode
newline sequences are the three just mentioned, plus the
single characters VT (vertical tab, U+000B), FF (formfeed,
U+000C), NEL (next line, U+0085), LS (line separator,
U+2028), and PS (paragraph separator, U+2029). The last
two are recognized only in UTF-8 mode.</p><p>The newline setting in the options word uses three bits
that are treated as a number, giving eight possibilities.
Currently only six are used (default plus the five values
above). This means that if you set more than one newline
option, the combination may or may not be sensible. For
example, <code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_cr">newline_cr</a></code> with <code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_lf">newline_lf</a></code> is equivalent to
<code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_crlf">newline_crlf</a></code>, but other combinations may yield unused numbers and
cause an error.</p><p>The only time that a line break is specially recognized
when compiling a pattern is if <code><a href="Text-Regex-PCRE-Light-Char8.html#v:extended">extended</a></code> is set, and
an unescaped # outside a character class is encountered.
This indicates a comment that lasts until after the next
line break sequence. In other circumstances, line break
sequences are treated as literal data, except that in
<code><a href="Text-Regex-PCRE-Light-Char8.html#v:extended">extended</a></code> mode, both CR and LF are treated as whitespace characters
and are therefore ignored. -- </p><p>The newline option that is set at compile time becomes the
default that is used for <code>exec</code> but it can be overridden.</p><p>newline_any :: PCREOption
newline_any = PCREOption newline_any_cint</p><p><code>newline_anycrlf</code>, see <code>newline_any</code>
newline_anycrlf :: PCREOption
newline_anycrlf = PCREOption newline_anycrlf_cint</p><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_cr">newline_cr</a></code>, see <code>newline_any</code></p></div></div><div class="top"><p class="src"><a id="v:newline_crlf" class="def">newline_crlf</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#newline_crlf" class="link">Source</a> <a href="#v:newline_crlf" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_crlf">newline_crlf</a></code>, see <code>newline_any</code></p></div></div><div class="top"><p class="src"><a id="v:newline_lf" class="def">newline_lf</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#newline_lf" class="link">Source</a> <a href="#v:newline_lf" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_lf">newline_lf</a></code>, see <code>newline_any</code></p></div></div><div class="top"><p class="src"><a id="v:no_auto_capture" class="def">no_auto_capture</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#no_auto_capture" class="link">Source</a> <a href="#v:no_auto_capture" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:no_auto_capture">no_auto_capture</a></code></p><p>If this option is set, it disables the use of numbered
capturing parentheses in the pattern. Any opening paren-
thesis that is not followed by ? behaves as if it were
followed by ?: but named parentheses can still be used for
capturing (and they acquire numbers in the usual way).
There is no equivalent of this option in Perl.</p></div></div><div class="top"><p class="src"><a id="v:ungreedy" class="def">ungreedy</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#ungreedy" class="link">Source</a> <a href="#v:ungreedy" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:ungreedy">ungreedy</a></code></p><p>This option inverts the <em>greediness</em> of the quantifiers so
that they are not greedy by default, but become greedy if
followed by <em>?</em>. It is not compatible with Perl. It can
also be set by a (?U) option setting within the pattern.</p></div></div><div class="top"><p class="src"><a id="v:utf8" class="def">utf8</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#utf8" class="link">Source</a> <a href="#v:utf8" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:utf8">utf8</a></code></p><p>This option causes PCRE to regard both the pattern and the
subject as strings of UTF-8 characters instead of single-byte character
strings. However, it is available only when
PCRE is built to include UTF-8 support. If not, the use of
this option provokes an error. Details of how this option
changes the behaviour of PCRE are given in the section on
UTF-8 support in the main pcre page.</p></div></div><div class="top"><p class="src"><a id="v:no_utf8_check" class="def">no_utf8_check</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREOption">PCREOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#no_utf8_check" class="link">Source</a> <a href="#v:no_utf8_check" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:no_utf8_check">no_utf8_check</a></code></p><p>When PCRE_UTF8 is set, the validity of the pattern as a
UTF-8 string is automatically checked. There is a discussion
about the validity of UTF-8 strings in the main pcre
page. If an invalid UTF-8 sequence of bytes is found,
compile() returns an error. If you already know that
your pattern is valid, and you want to skip this check for
performance reasons, you can set the <code><a href="Text-Regex-PCRE-Light-Char8.html#v:no_utf8_check">no_utf8_check</a></code>
option. When it is set, the effect of passing an invalid
UTF-8 string as a pattern is undefined. It may cause your
program to crash. Note that this option can also be passed
to <code>exec</code>, to suppress the UTF-8 validity checking of subject strings.</p></div></div><h2 id="g:5">PCRE exec-time bit flags</h2><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:PCREExecOption" class="def">PCREExecOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#PCREExecOption" class="link">Source</a> <a href="#t:PCREExecOption" class="selflink">#</a></p><div class="subs instances"><p id="control.i:PCREExecOption" class="caption collapser" onclick="toggleSection('i:PCREExecOption')">Instances</p><div id="section.i:PCREExecOption" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PCREExecOption:Eq:1" class="instance expander" onclick="toggleSection('i:id:PCREExecOption:Eq:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-432" class="link">Source</a> <a href="#t:PCREExecOption" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:PCREExecOption:Eq:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PCREExecOption:Ord:2" class="instance expander" onclick="toggleSection('i:id:PCREExecOption:Ord:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-432" class="link">Source</a> <a href="#t:PCREExecOption" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:PCREExecOption:Ord:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:compare">compare</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ordering">Ordering</a> <a href="#v:compare" class="selflink">#</a></p><p class="src"><a href="#v:-60-">(<)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60-" class="selflink">#</a></p><p class="src"><a href="#v:-60--61-">(<=)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62-">(>)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62-" class="selflink">#</a></p><p class="src"><a href="#v:-62--61-">(>=)</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62--61-" class="selflink">#</a></p><p class="src"><a href="#v:max">max</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="#v:max" class="selflink">#</a></p><p class="src"><a href="#v:min">min</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="#v:min" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PCREExecOption:Read:3" class="instance expander" onclick="toggleSection('i:id:PCREExecOption:Read:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-432" class="link">Source</a> <a href="#t:PCREExecOption" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:PCREExecOption:Read:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:readsPrec">readsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="#v:readsPrec" class="selflink">#</a></p><p class="src"><a href="#v:readList">readList</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a>] <a href="#v:readList" class="selflink">#</a></p><p class="src"><a href="#v:readPrec">readPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="#v:readPrec" class="selflink">#</a></p><p class="src"><a href="#v:readListPrec">readListPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a>] <a href="#v:readListPrec" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PCREExecOption:Show:4" class="instance expander" onclick="toggleSection('i:id:PCREExecOption:Show:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a></span> <a href="src/Text-Regex-PCRE-Light-Base.html#line-432" class="link">Source</a> <a href="#t:PCREExecOption" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:PCREExecOption:Show:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:exec_anchored" class="def">exec_anchored</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#exec_anchored" class="link">Source</a> <a href="#v:exec_anchored" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:anchored">anchored</a></code>.</p><p>The <code><a href="Text-Regex-PCRE-Light-Char8.html#v:anchored">anchored</a></code> option limits <code>exec</code> to matching at
the first matching position. If a pattern was compiled
with <code><a href="Text-Regex-PCRE-Light-Char8.html#v:anchored">anchored</a></code>, or turned out to be anchored by virtue
of its contents, it cannot be made unachored at matching
time.</p></div></div><div class="top"><p class="src"><a id="v:exec_newline_cr" class="def">exec_newline_cr</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#exec_newline_cr" class="link">Source</a> <a href="#v:exec_newline_cr" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_cr">newline_cr</a></code>, <code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_lf">newline_lf</a></code>,
<code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_crlf">newline_crlf</a></code>, <code>newline_anycrlf</code>, <code>newline_any</code></p><p>These options override the newline definition that was
chosen or defaulted when the pattern was compiled. For
details, see the description of <code>compile</code> above. Dur-
ing matching, the newline choice affects the behaviour of
the dot, circumflex, and dollar metacharacters. It may
also alter the way the match position is advanced after a
match failure for an unanchored pattern.</p><p>When <code><a href="Text-Regex-PCRE-Light-Char8.html#v:newline_crlf">newline_crlf</a></code>, <code>newline_anycrlf</code>, or <code>newline_any</code>
is set, and a match attempt for an unanchored
pattern fails when the current position is at a CRLF
sequence, and the pattern contains no explicit matches for
CR or LF characters, the match position is advanced by two
characters instead of one, in other words, to after the
CRLF.</p><p>The above rule is a compromise that makes the most common
cases work as expected. For example, if the pattern is .+A
(and the <code><a href="Text-Regex-PCRE-Light-Char8.html#v:dotall">dotall</a></code> option is not set), it does not match
the string <em>\r\nA</em> because, after failing at the start, it
skips both the CR and the LF before retrying. However, the
pattern <em>[\r\n]A</em> does match that string, because it contains
an explicit CR or LF reference, and so advances only
by one character after the first failure.</p><p>An explicit match for CR of LF is either a literal appear-
ance of one of those characters, or one of the \r or \n
escape sequences. Implicit matches such as [^X] do not
count, nor does \s (which includes CR and LF in the char-
acters that it matches).</p><p>Notwithstanding the above, anomalous effects may still
occur when CRLF is a valid newline sequence and explicit
\r or \n escapes appear in the pattern.</p><p>exec_newline_any :: PCREExecOption
exec_newline_any = PCREExecOption exec_newline_any_cint</p><p><code>exec_newline_anycrlf</code>, see <code>exec_newline_any</code>
exec_newline_anycrlf :: PCREExecOption
exec_newline_anycrlf = PCREExecOption exec_newline_anycrlf_cint</p><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:exec_newline_cr">exec_newline_cr</a></code>, see <code>exec_newline_any</code></p></div></div><div class="top"><p class="src"><a id="v:exec_newline_crlf" class="def">exec_newline_crlf</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#exec_newline_crlf" class="link">Source</a> <a href="#v:exec_newline_crlf" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:exec_newline_crlf">exec_newline_crlf</a></code>, see <code>exec_newline_any</code></p></div></div><div class="top"><p class="src"><a id="v:exec_newline_lf" class="def">exec_newline_lf</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#exec_newline_lf" class="link">Source</a> <a href="#v:exec_newline_lf" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:exec_newline_lf">exec_newline_lf</a></code>, see <code>exec_newline_any</code></p></div></div><div class="top"><p class="src"><a id="v:exec_notbol" class="def">exec_notbol</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#exec_notbol" class="link">Source</a> <a href="#v:exec_notbol" class="selflink">#</a></p><div class="doc"><p><code>PCRE_NOTBOL</code></p><p>This option specifies that first character of the subject
string is not the beginning of a line, so the circumflex
metacharacter should not match before it. Setting this
without <code><a href="Text-Regex-PCRE-Light-Char8.html#v:multiline">multiline</a></code> (at compile time) causes circumflex
never to match. This option affects only the behaviour of
the circumflex metacharacter. It does not affect \A.</p></div></div><div class="top"><p class="src"><a id="v:exec_noteol" class="def">exec_noteol</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#exec_noteol" class="link">Source</a> <a href="#v:exec_noteol" class="selflink">#</a></p><div class="doc"><p><code>noteol</code></p><p>This option specifies that the end of the subject string
is not the end of a line, so the dollar metacharacter
should not match it nor (except in multiline mode) a newline
immediately before it. Setting this without <code><a href="Text-Regex-PCRE-Light-Char8.html#v:multiline">multiline</a></code>
(at compile time) causes dollar never to match.
This option affects only the behaviour of the dollar
metacharacter. It does not affect \Z or \z.</p></div></div><div class="top"><p class="src"><a id="v:exec_notempty" class="def">exec_notempty</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#exec_notempty" class="link">Source</a> <a href="#v:exec_notempty" class="selflink">#</a></p><div class="doc"><p>PCRE_NOTEMPTY</p><p>An empty string is not considered to be a valid match if
this option is set. If there are alternatives in the pattern,
they are tried. If all the alternatives match the
empty string, the entire match fails. For example, if the
pattern</p><pre>a?b?</pre><p>is applied to a string not beginning with <em>a</em> or <em>b</em>, it
matches the empty string at the start of the subject. With
<code>notempty</code> set, this match is not valid, so 'PCRE
searches further into the string for occurrences of <em>a</em> or
<em>b</em>.</p><p>Perl has no direct equivalent of <code>notempty</code>, but it
does make a special case of a pattern match of the empty
string within its split() function, and when using the /g
modifier. It is possible to emulate Perl's behaviour after
matching a null string by first trying the match again at
the same offset with PCRE_NOTEMPTY and PCRE_ANCHORED, and
then if that fails by advancing the starting offset (see
below) and trying an ordinary match again. There is some
code that demonstrates how to do this in the pcredemo.c
sample program.</p></div></div><div class="top"><p class="src"><a id="v:exec_no_utf8_check" class="def">exec_no_utf8_check</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#exec_no_utf8_check" class="link">Source</a> <a href="#v:exec_no_utf8_check" class="selflink">#</a></p><div class="doc"><p><code><a href="Text-Regex-PCRE-Light-Char8.html#v:no_utf8_check">no_utf8_check</a></code></p><p>When <code><a href="Text-Regex-PCRE-Light-Char8.html#v:utf8">utf8</a></code> is set at compile time, the validity of the
subject as a UTF-8 string is automatically checked when
exec() is subsequently called. The value of
startoffset is also checked to ensure that it points to
the start of a UTF-8 character. There is a discussion
about the validity of UTF-8 strings in the section on
UTF-8 support in the main pcre page. If an invalid UTF-8
sequence of bytes is found, exec() returns the error
<code><a href="Text-Regex-PCRE-Light-Base.html#v:error_badutf8">error_badutf8</a></code>. If startoffset contains an invalid
value, <code><a href="Text-Regex-PCRE-Light-Base.html#v:error_badutf8_offset">error_badutf8_offset</a></code> is returned.</p><p>If you already know that your subject is valid, and you
want to skip these checks for performance reasons, you can
set the <code><a href="Text-Regex-PCRE-Light-Char8.html#v:no_utf8_check">no_utf8_check</a></code> option when calling
<code>exec</code>. You might want to do this for the second and
subsequent calls to exec() if you are making repeated
calls to find all the matches in a single subject string.
However, you should be sure that the value of startoffset
points to the start of a UTF-8 character. When
<code><a href="Text-Regex-PCRE-Light-Char8.html#v:no_utf8_check">no_utf8_check</a></code> is set, the effect of passing an
invalid UTF-8 string as a subject, or a value of startoff-
set that does not point to the start of a UTF-8 character,
is undefined. Your program may crash.</p></div></div><div class="top"><p class="src"><a id="v:exec_partial" class="def">exec_partial</a> :: <a href="Text-Regex-PCRE-Light-Char8.html#t:PCREExecOption">PCREExecOption</a> <a href="src/Text-Regex-PCRE-Light-Base.html#exec_partial" class="link">Source</a> <a href="#v:exec_partial" class="selflink">#</a></p><div class="doc"><p><code>partial</code></p><p>This option turns on the partial matching feature. If the
subject string fails to match the pattern, but at some
point during the matching process the end of the subject
was reached (that is, the subject partially matches the
pattern and the failure to match occurred only because
there were not enough subject characters), <code>exec</code>
returns <code><a href="Text-Regex-PCRE-Light-Base.html#v:error_partial">error_partial</a></code> instead of <code><a href="Text-Regex-PCRE-Light-Base.html#v:error_nomatch">error_nomatch</a></code>.
When <code>partial</code> is used, there are restrictions on what
may appear in the pattern. These are discussed in the
pcrepartial documentation.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|