InBdH      !"#$%&'()*+,-./0123456789:;<=>?@AB C D E F G Safe &)-3457N+pad String with Char to total length of Intpad '-' 5 "abc" "--abc" pad' '-' 5 "abc""abc--" HHNone &)-3457NIJIJNone &)-3457N K L M NOPQRST UV     UVSafe &)-3457Nboth Ascii and Utf8both Ascii and Utf8None &)-3457Nmay be omitted-if both Once and All are passed, All prevails!Offset, Length$Haystack&Needle* Body with some replacements made+Sposition adjustment: group replacement length may differ from replaced text length  !"#$%&'()*+,-./ !"#$%&'()*+,,()*+&'$%"#! /.-  !"#$%&'()*+,-./ None &)-3457NWmatch offset, lengthX all groupsYmatches for one groupWXYWXYWXY None &)-3457NZ[\]^Z[\Z[\]^None &)-3457N01 covers allGcompiler looks up the appropriate function depending on the result type(2) is borrowed from Text.Regex.Posix.Wrap, is a short version of 17. For those who put pattern & body in the right places.3tweak Regex with options_ match all` match once4("8"::String) =~ ("1K205B 8 EC65"::String)::[PosLen] [(13,2)] Utf8 a match all6"well" =~ "all is well that ends well"::[[ByteString]][["well"],["well"]] btest"2" =~ "B8E> 2 ;5AC"::BoolTruec match once""^all" =~ "all the time"::[String] ["all"] 012dmatched contentefmatched content3_`abc01230123 012def3_`abcNone &)-3457N5dynamic group replace,custom replacer fn returns replacement valuereplacer::GroupReplacer String' replacer = defaultReplacer 1 tweak1* where tweak1 str1 = case str1 of5 "101" -> "[AB> >48=]"0 "3" -> "[three]"; otherwise -> trace str1 "?" vs  optionsSreplaceGroup [Once,Utf8] (Pattern "\\w=(\\d{1,3})", replacer) $ Body "a=101 b=3 12""a=[AB> >48=] b=3 12"RreplaceGroup [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) needlePreplace [Once,Utf8] (Pattern "<5=55", Replacement "1>;55") $ Body "<5=55 <5=55" "1>;55 <5=55"Mreplace [Once,Utf8] (Pattern "^a\\s", Replacement "A") $ Body "a bc E>;.3>@.""Abc E>;.3>@." 8Byou can write a custom replacer. This is only one common use case.@Replaces specified (by idx) group match with tweaked value. 9get group content safelycall from your custom , passed to 7:call from your custom , passed to 7see example replacer above 4ghijklm567nop8 group idx"(group match -> replacement) tweak9qrs:replaceable, unadjusted(new val, acc passed to ,)new acctuvwxyz  456789:  567:8944ghijklm567nop89qrs:tuvwxyzNone &)-3457N<needle between parts disappears=#needle sticks to front of next part>%needle sticks to end of previous part?;replace (Pattern "\n") (Replacement ",") (Body "a\nbc\nde")"a,bc,de" @,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") A)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"] ;<=>?@{|}A~;<=>?@A@?A;<=> ;<=>?@{|}A~ 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" BCBCBC BC None &)-3457ND/removes leading and trailing spaces and tabs DEFGDEDEGFDEFG   !"#$%&'()*+,-."!/00112233456789:;<=>?@ABCDEFGH@IJ K L M N O PQRSTUVWXYZ[\]^_ ` a b c d e f ghijklmnopqrstuvwxyz{|}$~  regex_9hVuZhYHRYNGX0QzHj7bVHText.Regex.Do.TypeRegexText.Regex.Do.Pcre.MatchText.Regex.Do.PadText.Regex.Do.Pcre.OptionText.Regex.Do.ConvertText.Regex.Do.TypeDoText.Regex.Do.Pcre.ReplaceText.Regex.Do.SplitText.Regex.Do.FormatText.Regex.Do.TrimText.Regex.Do.Pcre.ResultText.Regex.Do.Pcre.Matchfregex_47KXx9dLqeO8MNJeizLKhPText.Regex.Base.RegexLike MatchArrayextractregex_D90DoxwgsTHEvoLrkciZPUText.Regex.PCRE.Wrap CompOption ExecOptionRegexpadpad'ExecBlankENotEmptyPartialCompBlankAnchoredCaselessDotall MultilineUtf8Ungreedycompexec toByteStringtoStringRegex_r_Rx_Opt_ ReplaceCaseOnceAllPosLen ReplacementBodyPattern ReplaceAccaccpos_adj GroupReplacer $fRegex_Regex $fRegex_[]$fRegex_ByteStringMatchmatch=~ makeRegexOptsMr_Replacereplace replaceGroupdefaultReplacergetGroup replaceMatch KeepNeedleDropFrontEndbreaksplitFormatformatTrimtrim$fTrim[]$fTrimByteStringpad_RegexSRegexB execBlank execNotEmpty execPartial compBlank compAnchored compCaseless compDotAll compMultilinecompUTF8 compUngreedycompOptexecOptposlen allMatches groupMatchMatchfmarray_poslen_ $fMatchf[]nh$fMatchfMaybenh $fMatchnh[] $fMatchnh[]0 $fMatchnh[]1 $fMatchnhBool $fMatchnh[]2 matchOnce matchTestmatchAllReplace_prefixsuffixconcat'len' toByteString'toAroncerall firstGroup adjustPoslen ronceGroup rallGroupaddOptisUtf8$fReplace_ByteString $fReplace_[]$fReplaceByteString $fReplace[]break' breakFrontbreakEndsplit'splitEnd splitFront checkPattern $fFormat[] $fFormat[]0 CustomerFn foldFn_idx foldFn_map replaceOne foldr_idxfoldFn