HA/Z      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS T U V W X Y None &)-3457NZ[Z[None &)-3457N \] ^ _ ` abcde fg     fgSafe &)-3457Nboth Ascii and Utf8both Ascii and Utf8None &)-3457Nmay be omitted-if both Once and All are passed, All prevailsOffset, LengthHaystack!Needle% Body with some replacements made&Sposition adjustment: group replacement length may differ from replaced text length  !"#$%&' !"#$%&''#$%&!"  !"#$%&'None &)-3457N(match offset, length) all groups*matches for one group()*()*()*()*None &)-3457N 45 covers all . funsKcompiler looks up the appropriate function depending on the result type 6tweak Regex with options:accepts  made with 6;accepts  made with 6<accepts regex h=accepts regex h>accepts regex i?accepts regex i&matchTest (Pattern "^ab") (Body "abc")True@3A2B1C0D/+,-./matched content0see Text.Regex.Do.Pcre.Result12matched content3see Text.Regex.Do.Pcre.Result456789:;<=>?@ABCD +,-./012345645DCBA@./01236?>=<;:,-987++,-./0123456789:;<=>?@ABCDNone &)-3457NFdynamic 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>@." IByou can write a custom replacer. This is only one common use case.@Replaces specified (by idx) group match with tweaked value. Jget group content safelycall from your custom ' passed to HKcall from your custom ' passed to Hsee example replacer above EjklmnopFGHqrsI group idx"(group match -> replacement) tweakJtuvKreplaceable, unadjusted(new val, acc passed to ')new accwxyz{|} EFGHIJK FGHKIJEEjklmnopFGHqrsIJtuvKwxyz{|}None &)-3457NL(front, end) : drop needle(break (Pattern ":") (Body "0123:oid:90")("0123", "oid:90")'break (Pattern "\n") (Body "a\nbc\nde")("a", "bc\nde") M(front, needle + end),breakFront (Pattern "\n") (Body "a\nbc\nde")("a", "\nbc\nde") N(front + needle, end)*breakEnd (Pattern "\n") (Body "a\nbc\nde")("a\n", "bc\nde") O;replace (Pattern "\n") (Replacement ",") (Body "a\nbc\nde")"a,bc,de" P'split (Pattern "\n") (Body "a\nbc\nde")["a", "bc", "de"]$split (Pattern " ") (Body "a bc de")["a", "bc", "de"]+split (Pattern "\\s") (Body "abc de fghi ")["abc de fghi "] Q*splitEnd (Pattern "\n") (Body "a\nbc\nde")["a\n", "bc\n", "de"] R,splitFront (Pattern "\n") (Body "a\nbc\nde")["a", "\nbc", "\nde"] LMNOPQR~LMNOPQRLMNOPQRLMNOPQR~ None &)-3457NU+pad String with Char to total length of Intpad '-' 5 "abc""--abc" 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" STUSTUUST STU None &)-3457NV/removes leading and trailing spaces and tabs VWXYVWVWYXVWXY   !"#$%&'())**++,,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVOWXY Z [ \ ] ^ _ `abcdefghijklmnopqrstuvwxyz{|}~   regex_2smdpkursq3F3xRLwgFNxjText.Regex.Do.TypeRegexText.Regex.Do.Pcre.ResultText.Regex.Do.Pcre.OptionText.Regex.Do.ConvertText.Regex.Do.TypeDoText.Regex.Do.Pcre.MatchText.Regex.Do.Pcre.ReplaceText.Regex.Do.SplitText.Regex.Do.FormatText.Regex.Do.Trimregex_47KXx9dLqeO8MNJeizLKhPText.Regex.Base.RegexLike MatchArrayextractregex_D90DoxwgsTHEvoLrkciZPUText.Regex.PCRE.Wrap CompOption ExecOptionRegexExecBlankENotEmptyPartialCompBlankAnchoredCaselessDotall MultilineUtf8Ungreedycompexec toByteStringtoStringOpt_ ReplaceCaseOnceAllPosLen ReplacementBodyPattern ReplaceAccaccpos_adj GroupReplacerposlen allMatches groupMatchRx_Regex_r_ ExplicitMatch matchOnce matchOnce' matchTestmatchAll matchAll'Matchmatch makeRegexOpts $fRegex_Regex $fRegex_[]$fRegex_ByteString$fExplicitMatchRegexByteString$fExplicitMatchRegex[]$fExplicitMatchByteString[]#$fExplicitMatchByteStringByteString$fExplicitMatch[]ByteString$fExplicitMatch[][] $fMatchnh[] $fMatchnh[]0 $fMatchnhBool$fMatchnhMaybe $fMatchnh[]1Mr_Replacereplace replaceGroupdefaultReplacergetGroup replaceMatchbreak breakFrontbreakEndsplitsplitEnd splitFrontFormatformatpadTrimtrim$fTrim[]$fTrimByteStringRegexSRegexB execBlank execNotEmpty execPartial compBlank compAnchored compCaseless compDotAll compMultilinecompUTF8 compUngreedycompOptexecOptbytes_6VWy06pWzJq9evDvK2d4w6Data.ByteString.Internal ByteStringbaseGHC.BaseStringReplace_prefixsuffixconcat'len' toByteString'toAroncerall firstGroup adjustPoslen ronceGroup rallGroupaddOptisUtf8$fReplace_ByteString $fReplace_[]$fReplaceByteString $fReplace[] checkPattern $fFormat[] $fFormat[]0 CustomerFn foldFn_idx foldFn_map replaceOne foldr_idxfoldFn