jauv      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF G H I J K L M N O P Q R S T U V W XYZ[\ ] ^ _ ` a b c d e f g h i j k l m n opqrstuSafe &)-3457N all once valuesvaluestest: does body match pattern?         Safe &)-3457N+pad String with Char to total length of Int pad on leftpad '-' 5 "abc" "--abc"  pad on rightpad' '-' 5 "abc""abc--" vvNone &)-3457NwxwxNone &)-3457N yz{|} ~!"#$ !"#$%& !"#$%& !"#$%& !"#$%&None &)-3457N)may be omitted*-if both Once and All are passed, All prevails-Offset, Length0Haystack2Needle6#content with some replacements made7Sposition adjustment: group replacement length may differ from replaced text length 8see Text.Regex.Do.Pcre.ReplaceOpen defaultReplacer for example implementation'()*+,-./0123456789'()*+,-./01234567898945672301./-()*+,''()*+,-./0123456789None &)-3457N<both Ascii and Utf8=both Ascii and Utf8:;<=>?:;<=<=:;?>:;<=>?None &)-3457N@ABCDE@ABABEDC@@ABCDE None &)-3457NF<see String, ByteString instances for implementation examplessee Text.Regex.Base.RegexLike for  detail FGHIJKLMNFGHIJ FGHNMLKIJFGHIJKLMN None &)-3457NPneedle between parts disappearsQ#needle sticks to front of next partR%needle sticks to end of previous partS;replace (Pattern "\n") (Replacement ",") (Body "a\nbc\nde")"a,bc,de" T,break Drop (Pattern "\n") (Body "a\nbc\nde")("a", "bc\nde")-break Front (Pattern "\n") (Body "a\nbc\nde")("a", "\nbc\nde")+break End (Pattern "\n") (Body "a\nbc\nde")("a\n", "bc\nde") U)split Drop (Pattern " ") (Body "a bc de")["a", "bc", "de"]space may be used-split Front (Pattern "\n") (Body "a\nbc\nde")["a", "\nbc", "\nde"]+split End (Pattern "\n") (Body "a\nbc\nde")["a\n", "bc\n", "de"] OPQRSTUOPQRSTUTSUOPQR OPQRSTU None &)-3457N key basedkey may be {any string};format ">2G8=:0 {a} =5 {b}" [("a","2K45;:8"),("b","AB>8B")]">2G8=:0 2K45;:8 =5 AB>8B" index based2format "=0 ?5@2>5 {0}, =0 2B>@>5 {0}" ["?5@;>2:0"]("=0 ?5@2>5 ?5@;>2:0, =0 2B>@>5 ?5@;>2:0"*format "Polly {0} a {1}" ["got","cracker"]"Polly got a cracker" VWVWVW VWNone &)-3457Nmatch offset, length all groupsmatches for one groupNone &)-3457Nmatched contentmatched contentNone &)-3457NXY covers all result typesGcompiler looks up the appropriate function depending on the result typeZ is borrowed from Text.Regex.PCRE.Wrap, is a short version of Y See also Text.Regex.Do.Pcre.MatchHint [tweak Regex with options match all match once "8" =~ "1K205B 8 EC65"::[PosLen][(13,2)]Utf8Text.Regex.Do.Pcre.MatchHint  match all6"well" =~ "all is well that ends well"::[[ByteString]][["well"],["well"]]Text.Regex.Do.Pcre.MatchHint test"2" =~ "B8E> 2 ;5AC"::BoolTrueText.Regex.Do.Pcre.MatchHint  match once""^all" =~ "all the time"::[String]["all"]Text.Regex.Do.Pcre.MatchHint XYZpatternbody[XYZ[XYZ[XYZ[ None&)-3457>LN\picks X instance where 2 and 0 are of the same type and inferrable 2 or 0 type determine the instancehandy when working with OverloadedStrings+, in other cases when compiler needs a hint'Test ("2"::ByteString) =~ "B8E> 2 ;5AC"True'Once ("^all"::String) =~ "all the time"["all"](PosLen' ("8"::String) =~ "1K205B 8 EC65"[(13,2)] \]^_hint & patternbody4type defined by the instance, determined by the hint`abcdefghi\]^_\]^_ihgfedcba` \]^_`abcdefghi None &)-3457Nj.:Sreplace (Just [(4,3)::PosLen]) (Replacement "4567") (Body "abc 123 def"::Body Text)"abc 4567 def"8 :replacer::GroupReplacer TextJ replacer = defaultReplacer 1 tweak1 -- 1: first match in group* where tweak1 str1 = case str1 of2 "123" -> "[1-2-3]"? otherwise -> traceShow str1 "?"Qreplace (Just ([(4,3),(8,2)]::[PosLen])) replacer (Body "abc 123 def"::Body Text)"abc [1-2-3] def" ldReplaces specified (by idx) group match with tweaked value. Works for one common simple use case8# can be used with complicated regexnanother custom dynamic replacer could e.g. inspect all group matches before looking up a replacement. mget group content safelysee l source for use examplencall from your custom 8 passed to  replaceGroupsee l source for use example jkl group idx"(group match -> replacement) tweakmnreplaceable, unadjusted(new val, acc passed to 8)new accjklmnjklmn jklmnNone &)-3457No%implementation detail for the curiousqdynamic group replace2custom replacer fn returns replacement value. See lreplacer::GroupReplacer String' replacer = defaultReplacer 1 tweak1* where tweak1 str1 = case str1 of5 "101" -> "[AB> >48=]"0 "3" -> "[three]"; otherwise -> trace str1 "?") vs * optionsMreplace [Once,Utf8] (Pattern "\\w=(\\d{1,3})") replacer $ Body "a=101 b=3 12""a=[AB> >48=] b=3 12"Lreplace [All,Utf8] (Pattern "\\w=(\\d{1,3})") replacer $ Body "a=101 b=3 12""a=[AB> >48=] b=[three] 12"+static replace for simple (no group) needle for no-regex  replacement see Text.Regex.Do.SplitQreplace [Once,Utf8] (Pattern "<5=55") (Replacement "1>;55") $ Body "<5=55 <5=55" "1>;55 <5=55"Nreplace [Once,Utf8] (Pattern "^a\\s") (Replacement "A") $ Body "a bc E>;.3>@.""Abc E>;.3>@." opqopqqop opqNone &)-3457Nr/removes leading and trailing spaces and tabs rstursrsutrstu  !!"#$%&'()*+,-./012345678 329::;;<<==>?@@ABCDEFGHIJKL M N O P Q R S T U V W X Y Z [ \ ] ^_`ab c d ` a e f g h i j k l m n o Z p q rstZuvwxyz{|}~   5regex_JDQfm6PZkH1AaM5dQVBvTYText.Regex.Do.Type.ReexportText.Regex.Do.Pcre.MatchText.Regex.Do.Type.MatchHintText.Regex.Do.PadText.Regex.Do.Pcre.OptionText.Regex.Do.Type.DoText.Regex.Do.ConvertText.Regex.Do.Type.Regex_Text.Regex.Do.Type.ExtractText.Regex.Do.SplitText.Regex.Do.FormatText.Regex.Do.Pcre.MatchHintText.Regex.Do.Pcre.ReplaceOpenText.Regex.Do.Pcre.ReplaceText.Regex.Do.TrimText.Regex.Do.Pcre.ResultText.Regex.Do.Pcre.Matchfregex_47KXx9dLqeO8MNJeizLKhPText.Regex.Base.RegexLike MatchArrayextractregex_D90DoxwgsTHEvoLrkciZPUText.Regex.PCRE.Wrap CompOption ExecOptionRegexHintunhintPosLen_PosLen'AllOnceTest $fHintPosLen_ $fHintPosLen' $fHintAll $fHintOnce $fHintTestpadpad'ExecBlankENotEmptyPartialCompBlankAnchoredCaselessDotall MultilineUtf8UngreedycompexecOpt_ ReplaceCasePosLen ReplacementBodyPattern ReplaceAccaccpos_adj GroupReplacerToArraytoArray toByteStringtoString $fToArray[]$fToArrayArrayRx_Regex_r_ $fRegex_Regex $fRegex_[]$fRegex_ByteStringExtract'concat'len'prefixsuffix$fExtract'Text $fExtractText$fExtract'ByteString $fExtract'[] KeepNeedleDropFrontEndreplacebreaksplitFormatformatMatchmatch=~ makeRegexOpts MatchHintF$fMatchHintAllByteString$fMatchHintOnceByteString$fMatchHintPosLen_ByteString$fMatchHintPosLen'ByteString$fMatchHintTestByteString$fMatchHintAll[]$fMatchHintOnce[]$fMatchHintPosLen_[]$fMatchHintPosLen'[]$fMatchHintTest[] ReplaceOpendefaultReplacergetGroup replaceMatch ReplaceCase_replace_Trimtrim$fTrim[]$fTrimByteStringpad_RegexSRegexB execBlank execNotEmpty execPartial compBlank compAnchored compCaseless compDotAll compMultilinecompUTF8 compUngreedycompOptexecOptExtractbreak' breakFrontbreakEndsplit'splitEnd splitFront checkPattern $fFormat[] $fFormat[]0 CustomerFn foldFn_idx foldFn_map replaceOne foldr_idxfoldFnposlen allMatches groupMatchMatchfmarray_poslen_onceall $fMatchf[]ab$fMatchfMaybeab $fMatchab[] $fMatchab[]0 $fMatchab[]1 $fMatchabBool $fMatchab[]2 firstGroup adjustPoslen$fReplaceOpen[]GroupReplacer$fReplaceOpenMaybeGroupReplacer$fReplaceOpen[]Replacement$fReplaceOpenMaybeReplacementbytes_6VWy06pWzJq9evDvK2d4w6Data.ByteString.Internal ByteStringvanilla_replaceaddOpt$fReplaceCase_GroupReplacer[]%$fReplaceCase_GroupReplacerByteString#$fReplaceCase_ReplacementByteString$fReplaceCase_Replacement[]