#      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q rstuvwxyz{|}~None,/4=>?@ACHVXID regex-doDclears default options: extended,caseSensitive,multiline regex regex-doAn 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 patterna?b?is applied to a string not beginning with "a" or "b", it matches an empty string at the start of the subject. With PCRE_NOTEMPTY set, this match is not valid, so PCRE searches further into the string for occurrences of "a" or "b". regex-dosee PCREPARTIAL(3) in  http://www.pcre.org/pcre.txtpcre man pages regex-do http://www.pcre.org/pcre.txtpcre man pages regex-do>clears default options: extended,caseSensitive,multiline regex regex-dothe pattern is forced to be "anchored", that is, it is constrained to match only at the first matching point in the string that is being searched (the "subject string").TThis effect can also be achieved by appropriate constructs in the pattern itself. regex-doBletters in the pattern match both upper and lower case letters.jIt 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 support. 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. regex-doya dot metacharacter in the pattern matches a character of any value, including one that indicates a newline.SHowever, it only ever matches one character, even if newlines are coded as CRLF.\Without this option, a dot does not match when the current position is at a newline.pThis option is equivalent to Perl's /s option, and it can be changed within a pattern by a (?s) option setting.lA negative class such as [^a] always matches newline characters, independent of the setting of this option. regex-doBy default, for the purposes of matching "start of line" and "end of line", PCRE treats the subject string as consisting of a single line of characters, even if it actually contains newlines. The "start of line" metacharacter (^) matches only at the start of the string, and the "end of line" metacharacter ($) matches only at the end of the string, or before a terminating newline (except when PCRE_DOLLAR_ENDONLY is set). Note, however, that unless PCRE_DOTALL is set, the "any character" metacharacter (.) does not match at a newline. This behaviour (for ^, $, and dot) is the same as Perl.When PCRE_MULTILINE it is set, the "start of line" and "end of line" constructs match immediately following or immediately before internal newlines in the subject string, respectively, as well as at the very start and end.oThis 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 occurrences of ^ or $ in a pattern, setting PCRE_MULTILINE has no effect. regex-doThis option causes PCRE to regard both the pattern and the subject as strings of UTF-8 characters instead of single-byte strings. However, it is available only when PCRE is built to include UTF 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 pcreunicode page. regex-doThis option inverts the "greediness" of the quantifiers so that they are not greedy by default, but become greedy if followed by "?".AIt can also be set by a (?U) option setting within the pattern.       Safe,/4=>?@ACHVXLregex-do+pad String with Char to total length of Int pad on leftpad '-' 5 "abc" "--abc" regex-do pad on rightpad' '-' 5 "abc""abc--" Safe,/4=>?@ACHVXRTregex-do) String returns regex construction error regex-doOffset, Length regex-do#content with some replacements made!regex-doSposition adjustment: group replacement length may differ from replaced text length "regex-dosee Text.Regex.Do.Replace.Open defaultReplacer for example implementation! "#Safe,/4=>?@ACHVXT&regex-doboth Ascii and Utf8'regex-doboth Ascii and Utf8$%&'&'$%Safe,/4=>?@ACHVXUregex-doHaystackregex-dotest: does body match pattern?Safe,/4=>?@ACHVXWt+regex-do replace all-regex-do replace once*+,-None,/4=>?@ACHVXXCNone,/4=>?@ACHVXY !"#*+,-"#! ,-*+None,/4=>?@ACHVX\N.regex-do<see String, ByteString instances for implementation examplessee Text.Regex.Base.RegexLike for  detail ./012./012None,/4=>?@ACHVX^~regex-domatch offset, lengthregex-do all groupsregex-domatches for one groupNone,/4=>?@ACHVXl68regex-dotReplaces specified (by idx) group match with value provided by (a -> a) fn. Works for one common simple use case"( can also be used with multi-group regexnanother custom dynamic replacer could e.g. inspect all group matches before looking up a replacement. 9regex-do)check if specified group index is within  boundsfor use within ":regex-doget group content safely:1non-existing group idx will not error but return 'adjust for previous replacements lengthsee 8 source for use example;regex-doDreplace group match while adjusting for previous replacements lengthsee 8 source for use example 8regex-do*group idx. 0: full match, groups: 1.. see regex-do#(group match -> replacement) lookup;regex-doreplaceable, unadjustedregex-do(new val, acc passed to ")regex-donew acc6789:;678:;9None,/4=>?@ACHVXn?regex-docatches regex construction errors regex-do internal type@AB@ABNone,/4=>?@ACHVXpjregex-domatched contentregex-domatched contentregex-domatched content  None,/4=>?@ACHVX{ Jregex-dokeep needle @ endLregex-dokeep needle @ frontNregex-doslices . drops needleto avoid clash with Prelude: import Prelude hiding((/)) or qualify OA with alias e.g. (assuming this module is imported with S alias): S./body -> pattern -> resultPregex-doSplit result: listQregex-doBreak result: tupleRregex-do)"a bc de" / " " -- space may be used["a", "bc", "de"] Sregex-do"a\nbc\nde" / "\n"("a", "bc\nde") Tregex-do"a\nbc\nde" -/ "\n"["a", "\nbc", "\nde"] Uregex-do"a\nbc\nde" -/ "\n"("a", "\nbc\nde") Vregex-do"a\nbc\nde" /- "\n"["a\n", "bc\n", "de"] Wregex-do"a\nbc\nde" /- "\n"("a\n", "bc\nde") JKLMNOPQNOLMJKQP None,/4=>?@ACHVXXregex-dosee Text.Regex.Do.Replace.Latin for implemented types" is implemented only for  Zregex-do replacer::GroupReplacer ByteString replacer = defaultReplacer 1 tweak1 where tweak1 bs1 = toByteString' $ if bs1 == toByteString "]" then "0S0" else "?" runFn1 `shouldBe` toByteString "10000000S0b_0]" where runFn1 = let rx1 = toByteString "(?<=0)(])" body1 = toByteString "1000000]b_0]" in replace (All rx1) replacer body1 `regex-dosucceeds unless "% fails due to mismatched pattern etc repl:  | "  aregex-dosucceeds unless "% fails due to mismatched pattern etc repl:  | "  bregex-doalways succeedscregex-doalways succeedsXYXY None,/4=>?@ACHVXdregex-dohint: * | , pattern: , ,  ByteString .String | ByteString pattern may contains regexbody: ,  ByteString result is  String body: - String returns regex construction errors. fregex-dob:  |  ByteStringgregex-dob:  |  ByteStringhregex-dob:  |  ByteStringiregex-dob:  |  ByteStringjregex-dosucceeds unless "% fails due to mismatched pattern etc repl:  |  ByteString | " replkregex-dosucceeds unless "% fails due to mismatched pattern etc repl:  |  ByteString | " repldede None,/4=>?@ACHVXlregex-do/removes leading and trailing spaces and tabs nregex-dosee lmlm None,/4=>?@ACHVXqregex-doreplace "\n" "," "a\nbc\nde""a,bc,de" qregex-doPattern regex-do Replacementregex-doBodyqqNone,/4=>?@ACHVXesregex-doimplemented a: a: template e.g. "today is {0}"!repl: replacement: [a] or [(a,a)]}regex-do key basedkey may be {any a}6">2G8=:0 {a} =5 {b}" < [("a","2K45;:8"),("b","AB>8B")]">2G8=:0 2K45;:8 =5 AB>8B"~regex-do index based.["F25BK", "<>@>65=>5"] > "40<5 {0}, 45BO< {1}""40<5 F25BK, 45BO< <>@>65=>5"'"Polly {0} a {1}" < ["wants","cracker"]"Polly wants a cracker"-["?5@;>2:0"] > "=0 ?5@2>5 {0}, =0 2B>@>5 {0}"("=0 ?5@2>5 ?5@;>2:0, =0 2B>@>5 ?5@;>2:0"rsutvsutrvNone,/4=>?@ACHVX regex-do pattern: , ,  compile  with  optbody: , out:[[]][[]][[]] regex-do pattern: , , @ compile  with  opt.String | ByteString pattern may contains regexbody: , out: out | E out : test if regex matches[] [][] regex-dob: ,  always succeeds regex-dob: ,  always succeeds regex-dob: ,  always succeeds precompiled regex as pattern let Right rx1 = makeRegexOpt (toByteString "]") [Utf8] [] -- add options as needed m1 = rx1 ~? (toByteString "1000000]b_0]")::[ByteString] m1 shouldBe [toByteString "]"] regex-dob: ,  always succeeds regex-dob: ,  always succeeds regex-do>(";5A"::String) ~* ("0;5ALN, 70;5ALN &"::String)::E [[String]]Right [[";5A"],[";5A"]] regex-dotest0("2"::String) ~? ("B8E> 2 ;5AC"::String)::E BoolRight True regex-do.("^q"::String) ~? ("q0DSH_"::String)::E [String]Right ["q"] None,/4=>?@ACHVX regex-do pattern: ,  ByteString, @body: ,  ByteStringout: out | E out[[]][[ ByteString]][[]]regex-do API changes: Once is hinted with  All is hinted with  9All regex-computing instances catch regex errors, return   out ( String is the error message) pattern: ,  ByteString, @.String | ByteString pattern may contains regexbody: ,  ByteStringout: out | E out: test if regex matches[][ ByteString][]2precompiled Regex may be used as pattern too. see Text.Regex.Do.Match.Utf8 regex-do%"" ~? "tourner gauche"::E [PosLen]Right [(8,2)] regex-doalways succeeds regex-dotest.always succeeds regex-dotest8"chilly" ~? "it's chilly inside, chilly outside"::E BoolRight True regex-do$"^all" ~? "all the time"::E [String]Right ["all"] regex-doalways succeeds regex-doalways succeeds regex-do j"chilly" ~* "it's chilly inside, chilly outside"::E [[ByteString]] Right [["chilly"],["chilly"]] regex-doalways succeeds  !"#$%&'()*+,-./01234567789::;<=>?@AABBCDEFGHIJKLMNOPQRSTUVWXYZ[\] ^ _ ` a b c d e f g h i j k K L l m n o p q r s t u K L v w x y z { | } ~  Lregex-do-3.2.2-inplaceText.Regex.Do.Type.DoText.Regex.Do.Match.Utf8Text.Regex.Do.Match.OptionText.Regex.Do.PadText.Regex.Do.Type.ConvertText.Regex.Do.Type.ExtractText.Regex.Do.Replace.OpenText.Regex.Do.Match.RegexText.Regex.Do.SplitText.Regex.Do.Replace.Utf8Text.Regex.Do.Replace.LatinText.Regex.Do.TrimText.Regex.Do.Replace.FastText.Regex.Do.Replace.TemplateText.Regex.Do.Match.LatinText.Regex.Do.Type.Do_Text.Regex.Do.Type.InternalText.Regex.Do.Type.MatchHintText.Regex.Do.Type.ReexportText.Regex.Do.Match.ResultText.Regex.Do.Match.MatchfTregex-base-0.94.0.0-1c4c4c24bca7c4206bc28ea09ce73322758c64dd2eeb82328e1623e1507bd213Text.Regex.Base.RegexLike MatchArrayextractTregex-pcre-0.95.0.0-03e3ccb7b606edd6d093e45698f04b132d27426c6f5f1ef5bbee4c73c21af9d1Text.Regex.PCRE.Wrap CompOption ExecOptionRegexExecBlankENotEmptyPartialCompBlankAnchoredCaselessDotall MultilineUtf8Ungreedycompexec$fEqComp $fOrdComp $fEnumComp$fEqExec $fOrdExec $fEnumExecpadpad'EPosLen ReplaceAccaccpos_adj GroupReplacerToArraytoArray toByteStringtoString $fToArray[]$fToArrayArrayAllOnceExtract'concat'len'prefixsuffix$fExtract'Text$fExtract'ByteString $fExtract'[]ReplacereplacedefaultReplacerboundsOkgetGroup replaceMatch$fReplace[]GroupReplacerb$fReplaceMaybeGroupReplacerb $fReplace[]bb$fReplaceMaybebb makeRegex makeRegexOpt $fRegexRegex $fRegex[]$fRegexByteString$fMonadFailRegexResult$fMonadRegexResult$fApplicativeRegexResult$fFunctorRegexResultSplitEnd/- SplitFront-/Split/LT $fSplit[] $fSplit(,)$fSplitFront[]$fSplitFront(,) $fSplitEnd[] $fSplitEnd(,)3$fReplaceAllByteStringGroupReplacerByteStringEither4$fReplaceOnceByteStringGroupReplacerByteStringEither0$fReplaceAllByteStringByteStringByteStringEither1$fReplaceOnceByteStringByteStringByteStringEither$fReplaceAll[][][]Either$fReplaceOnce[][][]Either)$fReplaceAllRegexreplByteStringByteString*$fReplaceOnceRegexreplByteStringByteString$fReplaceAllRegex[][][]$fReplaceOnceRegex[][][]!$fReplaceAllbGroupReplacerbEither$fReplaceAllbbbEither"$fReplaceOncebGroupReplacerbEither$fReplaceOncebbbEither$fReplaceAllRegexreplbb$fReplaceOnceRegexreplbbTrimtrim $fTrimText$fTrim[]$fTrimByteString ReplaceOneTemplate<> Formatable$fReplaceOneTextText$fReplaceOneIntText $fReplaceOneByteStringByteString$fReplaceOneIntByteString$fReplaceOne[][]$fReplaceOneInt[] $fTemplatea[]$fTemplatea[]0MatchAll~* MatchOnce~?$fMatchOnce[][]Either%$fMatchOnceByteStringByteStringEither$fMatchOnceRegexb[]$fMatchOnceRegexbBool$fMatchOnceRegexb[]0$$fMatchAllByteStringByteStringEither$fMatchAll[][]Either$fMatchAllRegexb[]$fMatchAllRegexb[]0$fWithRegex[]BoolBool$fWithRegex[][][]$fWithRegex[][][]0$fWithRegexByteStringoutout$fMatchAll[][]Either0%$fMatchAllByteStringByteStringEither0&$fMatchOnceByteStringByteStringEither0$fMatchOnce[][]Either0&$fMatchOnceByteStringByteStringEither1$fMatchOnce[][]Either1$fMatchOncebbEither$fMatchOncebbEither0$fMatchOncebbEither1$fMatchAllbbEither$fMatchAllbbEither0 execBlank execNotEmpty execPartial compBlank compAnchored compCaseless compDotAll compMultilinecompUTF8 compUngreedybase Data.EitherLeftBodyTestHintunhinthintExtractposlen allMatches groupMatch GHC.MaybeNothing RegexResultOpt_oncealltestMatchfposlen_marray_HPR_tagOncetagAll checkPatternbytestring-0.10.10.0Data.ByteString.Internal ByteStringGHC.BaseStringEither text-1.2.4.0 Data.TextstripData.Text.InternalTextghc-prim GHC.TypesBool