<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >Text.Regex.PCRE.Light.Char8</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_Text-Regex-PCRE-Light-Char8.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >pcre-light-0.4: A small, efficient and portable regex library for Perl 5 compatible regular expressions</TD ><TD CLASS="topbut" ><A HREF="src/Text-Regex-PCRE-Light-Char8.html" >Source code</A ></TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >Text.Regex.PCRE.Light.Char8</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >H98 + FFI</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >experimental</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >Don Stewart <dons@galois.com></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >The abstract PCRE Regex type </A ></DT ><DT ><A HREF="#2" >String interface </A ></DT ><DT ><A HREF="#3" >Regex types and constructors externally visible </A ></DT ><DD ><DL ><DT ><A HREF="#4" >PCRE compile-time bit flags </A ></DT ><DT ><A HREF="#5" >PCRE exec-time bit flags </A ></DT ></DL ></DD ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3ARegex" >Regex</A > </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Acompile" >compile</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> [<A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A >] -> <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3ARegex" >Regex</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcompileM" >compileM</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> [<A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A >] -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#t%3AEither" >Either</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3ARegex" >Regex</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Amatch" >match</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3ARegex" >Regex</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> [<A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A >] -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > [<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A >]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3APCREOption" >PCREOption</A > </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aanchored" >anchored</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aauto_callout" >auto_callout</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Acaseless" >caseless</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Adollar_endonly" >dollar_endonly</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Adotall" >dotall</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Adupnames" >dupnames</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aextended" >extended</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aextra" >extra</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Afirstline" >firstline</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Amultiline" >multiline</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Anewline_cr" >newline_cr</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Anewline_crlf" >newline_crlf</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Anewline_lf" >newline_lf</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Ano_auto_capture" >no_auto_capture</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aungreedy" >ungreedy</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Autf8" >utf8</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Ano_utf8_check" >no_utf8_check</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3APCREExecOption" >PCREExecOption</A > </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aexec_anchored" >exec_anchored</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aexec_newline_cr" >exec_newline_cr</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aexec_newline_crlf" >exec_newline_crlf</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aexec_newline_lf" >exec_newline_lf</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aexec_notbol" >exec_notbol</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aexec_noteol" >exec_noteol</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aexec_notempty" >exec_notempty</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aexec_no_utf8_check" >exec_no_utf8_check</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Aexec_partial" >exec_partial</A > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >The abstract PCRE Regex type </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:Regex" ><A NAME="t%3ARegex" ></A ></A ><B >Regex</B > </TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#Regex" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >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. </TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Regex')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:Regex" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3ARegex" >Regex</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Ord.html#t%3AOrd" >Ord</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3ARegex" >Regex</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShow" >Show</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3ARegex" >Regex</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="2" ><A NAME="2" >String interface </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:compile" ><A NAME="v%3Acompile" ></A ></A ><B >compile</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> [<A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A >] -> <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3ARegex" >Regex</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Char8.html#compile" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Acompile" >compile</A ></TT > </P ><P >Compile a perl-compatible regular expression, in a strict bytestring. The arguments are: </P ><UL ><LI > pat: A ByteString, which may or may not be zero-terminated, containing the regular expression to be compiled. </LI ><LI > flags, optional bit flags. If <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#v%3ANothing" >Nothing</A ></TT > is provided, defaults are used. </LI ></UL ><P >Valid compile-time flags are: </P ><UL ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aanchored" >anchored</A ></TT > - Force pattern anchoring </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aauto_callout" >auto_callout</A ></TT > - Compile automatic callouts </LI ><LI > bsr_anycrlf - \R matches only CR, LF, or CRLF </LI ><LI > bsr_unicode - \R matches all Unicode line endings </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Acaseless" >caseless</A ></TT > - Do caseless matching </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Adollar_endonly" >dollar_endonly</A ></TT > - <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#v%3A%24" >$</A ></TT > not to match newline at end </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Adotall" >dotall</A ></TT > - matches anything including NL </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Adupnames" >dupnames</A ></TT > - Allow duplicate names for subpatterns </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aextended" >extended</A ></TT > - Ignore whitespace and # comments </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aextra" >extra</A ></TT > - PCRE extra features (not much use currently) </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Afirstline" >firstline</A ></TT > - Force matching to be before newline </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Amultiline" >multiline</A ></TT > - <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#v%3A%5E" >^</A ></TT > and <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#v%3A%24" >$</A ></TT > match newlines within data </LI ><LI > newline_any - Recognize any Unicode newline sequence </LI ><LI > newline_anycrlf - Recognize CR, LF, and CRLF as newline sequences </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_cr" >newline_cr</A ></TT > - Set CR as the newline sequence </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_crlf" >newline_crlf</A ></TT > - Set CRLF as the newline sequence </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_lf" >newline_lf</A ></TT > - Set LF as the newline sequence </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Ano_auto_capture" >no_auto_capture</A ></TT > - Disable numbered capturing parentheses (named ones available) </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aungreedy" >ungreedy</A ></TT > - Invert greediness of quantifiers </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Autf8" >utf8</A ></TT > - Run in UTF-8 mode </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Ano_utf8_check" >no_utf8_check</A ></TT > - Do not check the pattern for UTF-8 validity </LI ></UL ><P >If compilation of the pattern fails, the <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#v%3ALeft" >Left</A ></TT > 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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:compileM" ><A NAME="v%3AcompileM" ></A ></A ><B >compileM</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> [<A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A >] -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Either.html#t%3AEither" >Either</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3ARegex" >Regex</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Char8.html#compileM" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3AcompileM" >compileM</A ></TT > A safe version of <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Acompile" >compile</A ></TT > with failure lifted into an Either </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:match" ><A NAME="v%3Amatch" ></A ></A ><B >match</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3ARegex" >Regex</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> [<A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A >] -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#t%3AMaybe" >Maybe</A > [<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A >]</TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Char8.html#match" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Amatch" >match</A ></TT > </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, <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Maybe.html#v%3ANothing" >Nothing</A ></TT > 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 > regex, a PCRE regular expression value produced by compile </LI ><LI > subject, the subject string to match against </LI ><LI > options, an optional set of exec-time flags to exec. </LI ></UL ><P >Available runtime options are: </P ><UL ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aanchored" >anchored</A ></TT > - Match only at the first position </LI ><LI > bsr_anycrlf - '\\R' matches only CR, LF, or CRLF </LI ><LI > bsr_unicode - '\\R' matches all Unicode line endings </LI ><LI > newline_any - Recognize any Unicode newline sequence </LI ><LI > newline_anycrlf - Recognize CR, LF, and CRLF as newline sequences </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_cr" >newline_cr</A ></TT > - Set CR as the newline sequence </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_crlf" >newline_crlf</A ></TT > - Set CRLF as the newline sequence </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_lf" >newline_lf</A ></TT > - Set LF as the newline sequence </LI ><LI > notbol - Subject is not the beginning of a line </LI ><LI > noteol - Subject is not the end of a line </LI ><LI > notempty - An empty string is not a valid match </LI ><LI > <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Ano_utf8_check" >no_utf8_check</A ></TT > - Do not check the subject for UTF-8 </LI ><LI > partial - 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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="3" ><A NAME="3" >Regex types and constructors externally visible </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="4" ><A NAME="4" >PCRE compile-time bit flags </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:PCREOption" ><A NAME="t%3APCREOption" ></A ></A ><B >PCREOption</B > </TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#PCREOption" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >A type for PCRE compile-time options. These are newtyped CInts, which can be bitwise-or'd together, using '(Data.Bits..|.)' </TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:PCREOption')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:PCREOption" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Ord.html#t%3AOrd" >Ord</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Read.html#t%3ARead" >Read</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShow" >Show</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:anchored" ><A NAME="v%3Aanchored" ></A ></A ><B >anchored</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#anchored" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aanchored" >anchored</A ></TT > </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:auto_callout" ><A NAME="v%3Aauto_callout" ></A ></A ><B >auto_callout</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#auto_callout" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aauto_callout" >auto_callout</A ></TT > </P ><P >If this bit is set, <A HREF="compile.html" >compile</A > automatically inserts callout items, all with number 255, before each pattern item. For discussion of the callout facility, see the man pcrecallout documentation </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:caseless" ><A NAME="v%3Acaseless" ></A ></A ><B >caseless</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#caseless" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >bsr_anycrlf and bsr_unicode </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 >bsr_unicode. See bse_anycrlf </P ><P >bsr_unicode :: PCREOption bsr_unicode = PCREOption bsr_unicode_cint </P ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Acaseless" >caseless</A ></TT > </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:dollar_endonly" ><A NAME="v%3Adollar_endonly" ></A ></A ><B >dollar_endonly</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#dollar_endonly" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Adollar_endonly" >dollar_endonly</A ></TT > </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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Adollar_endonly" >dollar_endonly</A ></TT > option is ignored if <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Amultiline" >multiline</A ></TT > is set. There is no equivalent to this option in Perl, and no way to set it within a pattern. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:dotall" ><A NAME="v%3Adotall" ></A ></A ><B >dotall</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#dotall" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Adotall" >dotall</A ></TT > </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:dupnames" ><A NAME="v%3Adupnames" ></A ></A ><B >dupnames</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#dupnames" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Adupnames" >dupnames</A ></TT > </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:extended" ><A NAME="v%3Aextended" ></A ></A ><B >extended</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#extended" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aextended" >extended</A ></TT > </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:extra" ><A NAME="v%3Aextra" ></A ></A ><B >extra</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#extra" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aextra" >extra</A ></TT > </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:firstline" ><A NAME="v%3Afirstline" ></A ></A ><B >firstline</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#firstline" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Afirstline" >firstline</A ></TT > </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:multiline" ><A NAME="v%3Amultiline" ></A ></A ><B >multiline</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#multiline" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Amultiline" >multiline</A ></TT > </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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Adollar_endonly" >dollar_endonly</A ></TT > is set). This is the same as Perl. </P ><P >When <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Amultiline" >multiline</A ></TT > 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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:newline_cr" ><A NAME="v%3Anewline_cr" ></A ></A ><B >newline_cr</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#newline_cr" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >newline_cr', <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_lf" >newline_lf</A ></TT >, <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_crlf" >newline_crlf</A ></TT >, newline_anycrlf, newline_any </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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_crlf" >newline_crlf</A ></TT > specifies that a newline is indicated by the two-character CRLF sequence. Setting newline_anycrlf specifies that any of the three preceding sequences should be recognized. Setting newline_any 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, <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_cr" >newline_cr</A ></TT > with <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_lf" >newline_lf</A ></TT > is equivalent to <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_crlf" >newline_crlf</A ></TT >, 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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aextended" >extended</A ></TT > 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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aextended" >extended</A ></TT > 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 exec but it can be overridden. </P ><P >newline_any :: PCREOption newline_any = PCREOption newline_any_cint </P ><P >newline_anycrlf, see newline_any newline_anycrlf :: PCREOption newline_anycrlf = PCREOption newline_anycrlf_cint </P ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_cr" >newline_cr</A ></TT >, see newline_any </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:newline_crlf" ><A NAME="v%3Anewline_crlf" ></A ></A ><B >newline_crlf</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#newline_crlf" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_crlf" >newline_crlf</A ></TT >, see newline_any </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:newline_lf" ><A NAME="v%3Anewline_lf" ></A ></A ><B >newline_lf</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#newline_lf" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_lf" >newline_lf</A ></TT >, see newline_any </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:no_auto_capture" ><A NAME="v%3Ano_auto_capture" ></A ></A ><B >no_auto_capture</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#no_auto_capture" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Ano_auto_capture" >no_auto_capture</A ></TT > </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:ungreedy" ><A NAME="v%3Aungreedy" ></A ></A ><B >ungreedy</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#ungreedy" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aungreedy" >ungreedy</A ></TT > </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:utf8" ><A NAME="v%3Autf8" ></A ></A ><B >utf8</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#utf8" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Autf8" >utf8</A ></TT > </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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:no_utf8_check" ><A NAME="v%3Ano_utf8_check" ></A ></A ><B >no_utf8_check</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREOption" >PCREOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#no_utf8_check" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Ano_utf8_check" >no_utf8_check</A ></TT > </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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Ano_utf8_check" >no_utf8_check</A ></TT > 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 exec, to suppress the UTF-8 validity checking of subject strings. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="5" ><A NAME="5" >PCRE exec-time bit flags </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:PCREExecOption" ><A NAME="t%3APCREExecOption" ></A ></A ><B >PCREExecOption</B > </TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#PCREExecOption" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:PCREExecOption')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:PCREExecOption" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Ord.html#t%3AOrd" >Ord</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Read.html#t%3ARead" >Read</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShow" >Show</A > <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:exec_anchored" ><A NAME="v%3Aexec_anchored" ></A ></A ><B >exec_anchored</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#exec_anchored" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aanchored" >anchored</A ></TT >. </P ><P >The <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aanchored" >anchored</A ></TT > option limits exec to matching at the first matching position. If a pattern was compiled with <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aanchored" >anchored</A ></TT >, or turned out to be anchored by virtue of its contents, it cannot be made unachored at matching time. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:exec_newline_cr" ><A NAME="v%3Aexec_newline_cr" ></A ></A ><B >exec_newline_cr</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#exec_newline_cr" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_cr" >newline_cr</A ></TT >, <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_lf" >newline_lf</A ></TT >, <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_crlf" >newline_crlf</A ></TT >, newline_anycrlf, newline_any </P ><P >These options override the newline definition that was chosen or defaulted when the pattern was compiled. For details, see the description of compile 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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Anewline_crlf" >newline_crlf</A ></TT >, newline_anycrlf, or newline_any 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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Adotall" >dotall</A ></TT > 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 >exec_newline_anycrlf, see exec_newline_any exec_newline_anycrlf :: PCREExecOption exec_newline_anycrlf = PCREExecOption exec_newline_anycrlf_cint </P ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aexec_newline_cr" >exec_newline_cr</A ></TT >, see exec_newline_any </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:exec_newline_crlf" ><A NAME="v%3Aexec_newline_crlf" ></A ></A ><B >exec_newline_crlf</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#exec_newline_crlf" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aexec_newline_crlf" >exec_newline_crlf</A ></TT >, see exec_newline_any </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:exec_newline_lf" ><A NAME="v%3Aexec_newline_lf" ></A ></A ><B >exec_newline_lf</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#exec_newline_lf" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Aexec_newline_lf" >exec_newline_lf</A ></TT >, see exec_newline_any </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:exec_notbol" ><A NAME="v%3Aexec_notbol" ></A ></A ><B >exec_notbol</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#exec_notbol" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >PCRE_NOTBOL </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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Amultiline" >multiline</A ></TT > (at compile time) causes circumflex never to match. This option affects only the behaviour of the circumflex metacharacter. It does not affect \A. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:exec_noteol" ><A NAME="v%3Aexec_noteol" ></A ></A ><B >exec_noteol</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#exec_noteol" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >noteol </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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Amultiline" >multiline</A ></TT > (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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:exec_notempty" ><A NAME="v%3Aexec_notempty" ></A ></A ><B >exec_notempty</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#exec_notempty" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD 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 notempty 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 notempty, 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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:exec_no_utf8_check" ><A NAME="v%3Aexec_no_utf8_check" ></A ></A ><B >exec_no_utf8_check</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#exec_no_utf8_check" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P ><TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Ano_utf8_check" >no_utf8_check</A ></TT > </P ><P >When <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Autf8" >utf8</A ></TT > 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 <TT ><A HREF="Text-Regex-PCRE-Light-Base.html#v%3Aerror_badutf8" >error_badutf8</A ></TT >. If startoffset contains an invalid value, <TT ><A HREF="Text-Regex-PCRE-Light-Base.html#v%3Aerror_badutf8_offset" >error_badutf8_offset</A ></TT > 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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Ano_utf8_check" >no_utf8_check</A ></TT > option when calling exec. 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 <TT ><A HREF="Text-Regex-PCRE-Light-Char8.html#v%3Ano_utf8_check" >no_utf8_check</A ></TT > 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 ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:exec_partial" ><A NAME="v%3Aexec_partial" ></A ></A ><B >exec_partial</B > :: <A HREF="Text-Regex-PCRE-Light-Char8.html#t%3APCREExecOption" >PCREExecOption</A ></TD ><TD CLASS="declbut" ><A HREF="src/Text-Regex-PCRE-Light-Base.html#exec_partial" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >partial </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), exec returns <TT ><A HREF="Text-Regex-PCRE-Light-Base.html#v%3Aerror_partial" >error_partial</A ></TT > instead of <TT ><A HREF="Text-Regex-PCRE-Light-Base.html#v%3Aerror_nomatch" >error_nomatch</A ></TT >. When partial is used, there are restrictions on what may appear in the pattern. These are discussed in the pcrepartial documentation. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.6.1</TD ></TR ></TABLE ></BODY ></HTML >