Y7Q6[      !"#$%&'()*+,-./0123456789:;<=> ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Safe &)-3457N+pad String with Char to total length of Int pad on leftpad '-' 5 "abc" "--abc"  pad on rightpad' '-' 5 "abc""abc--" [[None &)-3457N\]\]None &)-3457N ^ _ ` abcdefg hi     hiSafe &)-3457Nboth Ascii and Utf8both Ascii and Utf8None &)-3457Nmay be omitted-if both Once and All are passed, All prevails!Offset, Length$Haystack&Needle*#content with some replacements made+Sposition adjustment: group replacement length may differ from replaced text length ,see Text.Regex.Do.Pcre.ReplaceOpen defaultReplacer for example implementation !"#$%&'()*+,-./0 !"#$%&'()*+,-,-()*+&'$%"#! 0/.  !"#$%&'()*+,-./0None &)-3457N2needle between parts disappears3#needle sticks to front of next part4%needle sticks to end of previous part5;replace (Pattern "\n") (Replacement ",") (Body "a\nbc\nde")"a,bc,de" 6,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") 7)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"] 123456jkl7mnop12345676571234 123456jkl7mnopNone &)-3457Nq 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"r 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" s89tuvwxqr8989 s89tuvwxqr None &)-3457Nymatch offset, lengthz all groups{matches for one groupyz{yz{yz{None &)-3457N|}~matched contentmatched content|}~|}~None &)-3457N:; covers all result typesGcompiler looks up the appropriate function depending on the result type< is borrowed from Text.Regex.PCRE.Wrap, is a short version of ; See also Text.Regex.Do.Pcre.MatchSame =tweak Regex with options match all match once "8" =~ "1K205B 8 EC65"::[PosLen][(13,2)]Utf8Text.Regex.Do.Pcre.MatchSame  match all6"well" =~ "all is well that ends well"::[[ByteString]][["well"],["well"]]Text.Regex.Do.Pcre.MatchSame test"2" =~ "B8E> 2 ;5AC"::BoolTrueText.Regex.Do.Pcre.MatchSame  match once""^all" =~ "all the time"::[String]["all"]Text.Regex.Do.Pcre.MatchSame :;<patternbody=:;<=:;<=:;<= None &)-3457N>picks : instance where & and $ are of the same typespecify either & or $ + out typeshandy when working with OverloadedStrings,("^all"::String) -~ "all the time"::[String] ["all"] >?@patternbody- in (@) is the minus signABCDEFGHIJ>?@ >?@JIHGFEDCBA >?@ABCDEFGHIJ None &)-3457NM<see String, ByteString instances for implementation examplessee Text.Regex.Base.RegexLike for  detail QdReplaces specified (by idx) group match with tweaked value. Works for one common simple use case,# can be used with complicated regexnanother custom dynamic replacer could e.g. inspect all group matches before looking up a replacement. Rget group content safelysee Q source for use exampleScall from your custom , passed to  replaceGroupsee Q source for use example KLMNOPQ group idx"(group match -> replacement) tweakRSreplaceable, unadjusted(new val, acc passed to ,)new acc KLMNOPQRS KLPMNOQRSKLMNOPQRS None &)-3457NVdynamic group replace2custom replacer fn returns replacement value. See Qreplacer::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>@." TUVTUVVTU TUV None &)-3457NW/removes leading and trailing spaces and tabs WXYZWXWXZYWXYZ !"#$%&'()*+,-./0$#12233445567889:;<=>?@ABCDEFGH I J K L M N O P Q R S T U V @ W X Y Z [ \ ] ^ _ @ ` a b cdefghijklmnopqrstuvwxyz{|}~   & regex_HJQEFKWVVOo8pJsHpSrdOkText.Regex.Do.TypeRegexText.Regex.Do.Pcre.MatchText.Regex.Do.PadText.Regex.Do.Pcre.OptionText.Regex.Do.ConvertText.Regex.Do.TypeDoText.Regex.Do.SplitText.Regex.Do.FormatText.Regex.Do.Pcre.MatchSameText.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 ExecOptionRegexpadpad'ExecBlankENotEmptyPartialCompBlankAnchoredCaselessDotall MultilineUtf8Ungreedycompexec toByteStringtoStringRegex_r_Rx_Opt_ ReplaceCaseOnceAllPosLen ReplacementBodyPattern ReplaceAccaccpos_adj GroupReplacer $fRegex_Regex $fRegex_[]$fRegex_ByteString KeepNeedleDropFrontEndreplacebreaksplitFormatformatMatchmatch=~ makeRegexOpts MatchSamematch'-~$fMatchSameByteString[]$fMatchSameByteString[]0$fMatchSameByteString[]1$fMatchSameByteString[]2$fMatchSameByteStringBool$fMatchSame[][]$fMatchSame[][]0$fMatchSame[][]1$fMatchSame[][]2$fMatchSame[]Bool ReplaceOpenExtract'concat'len'toArraydefaultReplacergetGroup replaceMatch ReplaceCase_replace_Trimtrim$fTrim[]$fTrimByteStringpad_RegexSRegexB execBlank execNotEmpty execPartial compBlank compAnchored compCaseless compDotAll compMultilinecompUTF8 compUngreedycompOptexecOptbreak' 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[]2Extractprefixsuffix firstGroup adjustPoslen$fExtract'Text $fExtractText$fExtract'ByteString $fExtract'[]$fReplaceOpen[]GroupReplacer$fReplaceOpenMaybeGroupReplacer$fReplaceOpen[]Replacement$fReplaceOpenMaybeReplacementbytes_6VWy06pWzJq9evDvK2d4w6Data.ByteString.Internal ByteStringvanilla_replaceaddOpt$fReplaceCase_GroupReplacer[]%$fReplaceCase_GroupReplacerByteString#$fReplaceCase_ReplacementByteString$fReplaceCase_Replacement[]