!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW X Y Z [ \ ] ^ _ ` a b c d e f g h i jklm n o p q r s t u v w x y z { | } ~  Safe&)-3457>LN+pad String with Char to total length of Int pad on leftpad '-' 5 "abc" "--abc"  pad on rightpad' '-' 5 "abc""abc--" None&)-3457>LNNone&)-3457>LN Dclears default options: extended,caseSensitive,multiline regex An 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". see PCREPARTIAL(3) in  http://www.pcre.org/pcre.txtpcre man pages  http://www.pcre.org/pcre.txtpcre man pages >clears default options: extended,caseSensitive,multiline regexthe 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. Bletters 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. ya 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. By 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. This 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. This 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&)-3457>LNalloncevalues values"test: does body match pattern? !"#$%&'()* !"#!" *)('&%$# !"#$%&'()*Safe&)-3457>LN .2does not do any codec. Plain wrap / unwrap newtype2values3Offset, Length6Haystack8Needle<#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 implementationC2does not do any codec. Plain wrap / unwrap newtype+,-./0123456789:;<=>?@ABCDEFG+,-./0123456789:;<=>?>?:;<=G89F67E45D312C./0+,-BA@+,-./0123456789:;<=>?@ABCDEFGSafe&)-3457>LNJboth Ascii and Utf8Lboth Ascii and Utf8HIJKLMNHIJKLJKLHINMHIJKLMNNone&)-3457>LNtweak Regex with options OPQRSTUVOPQRSTUVRSTUVQPO OPQRSTUV None&)-3457>LNXneedle between parts disappearsY#needle sticks to front of next partZ%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") ])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"] WXYZ[\]WXYZ[\]\[]WXYZ WXYZ[\] None&)-3457>LN 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" ^_^_^_ ^_Safe&)-3457>LNmatch offset, length all groupsmatches for one group None&)-3457>LN `abcdefmatched contentgmatched contenthi`abcdefg e`abcdihfg`abcdefghiNone&)-3457>LNja: ,  ByteString, Rb: ,  ByteStringout: [], [[]], [ ByteString], [[ ByteString]], , [3], [[3]]k covers all result typesGcompiler looks up the appropriate function depending on the result typel is borrowed from Text.Regex.PCRE.Wrap, is a short version of k2precompiled Regex may be used as pattern too. see Text.Regex.Do.Pcre.Utf8.Match See also "Text.Regex.Do.Pcre.Ascii.MatchHint l synonym for k. arg without newtypes match all match once#"" =~ "tourner gauche"::[PosLen] [(8,2)]  match all6"well" =~ "all is well that ends well"::[[ByteString]][["well"],["well"]] test"2" =~ "B8E> 2 ;5AC"::BoolTrue  match once""^all" =~ "all the time"::[String] ["all"] jklpatternbodyjkljkljkl None&)-3457>LNmhint: , , !, , a: , picks j instance where 8 and 6 are of the same type and inferrable 8 or 6 type determine the instancehandy when working with OverloadedStrings-, in other cases when compiler needs a hint u'Test ("2"::ByteString) =~ "B8E> 2 ;5AC"True w'Once ("^all"::String) =~ "all the time"["all"] y(PosLen' ("8"::String) =~ "1K205B 8 EC65"[(13,2)] mnophint & patternbody4type defined by the instance, determined by the hintqrstuvwxyzmnopmnopzyxwvutsrq mnopqrstuvwxyz Safe&)-3457>LN{<see String, ByteString instances for implementation examplessee Text.Regex.Base.RegexLike for  detail {|}~{|}~ {|}~ {|}~Safe&)-3457>LN4:Sreplace (Just [(4,3)::PosLen]) (Replacement "4567") (Body "abc 123 def"::Body Text)"abc 4567 def"> :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" dReplaces 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. get group content safely:1non-existing group idx will not error but return 'adjust for previous replacements lengthsee  source for use exampleDreplace group match while adjusting for previous replacements lengthsee  source for use example  group idx"(group match -> replacement) tweakreplaceable, unadjusted(new val, acc passed to >)new acc None&)-3457>LN internal class & instancesuse  instead  | 9 needs to be specified once with either pat, repl or bodypat: a:  |  ByteString | a( |  (a))( |  (8 a)) repl: b:  |  ByteString(4 b)(> b)( |  (4 b))( |  (> b)) body: b:  |  ByteStringb6 b( |  (b))out: |  ByteStringto tweak regex with   or , see Text.Regex.Do.Type.Regexdynamic group replace2custom replacer fn returns replacement value. See replacer::GroupReplacer String' replacer = defaultReplacer 1 tweak1* where tweak1 str1 = case str1 of2 "101" -> "[1 0 1]". "3" -> "[ 3 ]"; otherwise -> trace str1 "?"Greplace (All (Pattern "\\w=(\\d{1,3})")) replacer $ Body "a=101 b=3 12""a=[1 0 1] b=[ 3 ] 12" +static replace for simple (no group) needle for no-regex  ByteString replacement see Text.Regex.Do.Split@replace (Once (Pattern "^a\\s")) (Replacement "A") (Body "a bc")"Abc"dynamic group replaceHreplace (Once (Pattern "\\w=(\\d{1,3})")) replacer $ Body "a=101 b=3 12""a=[1 0 1] b=3 12" hint 6hint 6/replace "^a\\s" (Replacement "A") $ Once "a bc" hint repl/replace "^a\\s" (Once (Replacement "A")) "a bc"hint 8/replace (Once "^a\\s") (Replacement "A") "a bc"full typed arg@replace (Once (Pattern "^a\\s")) (Replacement "A") (Body "a bc") None&)-3457>LN internal class & instancesuse  instead see  Text.Regex.Do.Pcre.Ascii.Replace for implemented types-in full typed instance every b is wrapped in 1 newtype> is implemented only for  to tweak regex with Comp or Exec, see Text.Regex.Do.Type.Regexnote  Once_Utf8 and All_Utf8 hints *replacer::GroupReplacer (Utf8_ ByteString)+ replacer = defaultReplacer 1 tweak1+ where tweak1 bs1 = toByteString' $? if bs1 == toByteString' "]" then* "0S0". else "?"/runFn1 `shouldBe` toByteString "10000000S0b_0]" where runFn1 == let rx1 = Pattern $ toByteString' "(?<=0)(])"? body1 = Body $ toByteString' "1000000]b_0]"; in replace (All rx1) replacer body1 hint 6replace "?@074=8:" (Replacement "@04>ABL")) (All "M:70<5= - 2A5340 ?@074=8:")hint 6replace "?@074=8:" (Replacement "@04>ABL")* (Once "M:70<5= - 2A5340 ?@074=8:") hint repl$replacer::GroupReplacer (ByteString)#replacer = defaultReplacer 1 tweak1 where tweak1 s1G | s1 == toByteString "[:><0=4K]" = toByteString " - /"B | s1 == toByteString "[AGQB]" = toByteString "5:0"= | s1 == toByteString "[:0:0O 1>;L, ]" = empty= | otherwise = traceShow s1 $ toByteString "?"(let rx1 = toByteString "(\\[[^\\]]+\\])"? body1 = toByteString "[:0:0O 1>;L, ][:><0=4K] : [AGQB]"' in replace rx1 (All replacer) body1" - / : 5:0" hint 8replace (All "?@074=8:") (Replacement "@04>ABL")# "M:70<5= - 2A5340 ?@074=8:"full typed arg+replace (Once $ Pattern $ Utf8_ "?@074=8:")' (Replacement $ Utf8_ "@04>ABL")2 (Body $ Utf8_ "M:70<5= - 2A5340 ?@074=8:")None&)-3457>LNenc: 1a: , , b: , out: [], [[]], [], [[]], , [3], [[3]] synonym for . arg without newtypes match all match once4("8"::String) =~ ("1K205B 8 EC65"::String)::[PosLen] [(13,2)]  match allF("well"::String) =~ ("all is well that ends well"::String)::[[String]][["well"],["well"]] 4test. Note that a and b may be different types e.g.  and 1toByteString "2" =~ ("B8E> 2 ;5AC"::String)::Bool True  match onceprecompiled regex as patternZlet rx1 = makeRegexOpt' (Pattern $ toByteString' "]") [] [] -- add options as needed rx2 = Utf8_ <$> rx1L m1 = U.match rx2 (Body $ toByteString' "1000000]b_0]")::[ByteString]- m1 `shouldBe` [toByteString "]"] patternbody None&)-3457>LNhint: , , !, , a: , enc: 1picks  instance where 8 and 6 are of the same type and inferrable 8 or 6 type determine the instancehandy when working with OverloadedStrings-, in other cases when compiler needs a hint 5Test (toByteString "2") =~ toByteString "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 None&)-3457>LN/removes leading and trailing spaces and tabs  !"#$%&'()*+,-./011223344556789:;<=>?@ABCDDEFFGGHHIIJKLLMNOPQRSTUVWXYZ[\]^_`ab c d e f g h i j k l m n o p q r s t uvwx y z w x { | } ~   gggvwxyzwx  regex_3gqrTgAaRMB3shhDx8zozcText.Regex.Do.Type.ReexportText.Regex.Do.Pcre.Ascii.MatchText.Regex.Do.PadText.Regex.Do.Pcre.OptionText.Regex.Do.Type.MatchHintText.Regex.Do.Type.DoText.Regex.Do.ConvertText.Regex.Do.Type.RegexText.Regex.Do.SplitText.Regex.Do.FormatText.Regex.Do.Pcre.Matchf"Text.Regex.Do.Pcre.Ascii.MatchHintText.Regex.Do.Type.ExtractText.Regex.Do.ReplaceOpen Text.Regex.Do.Pcre.Ascii.ReplaceText.Regex.Do.Pcre.Utf8.ReplaceText.Regex.Do.Pcre.Utf8.Match!Text.Regex.Do.Pcre.Utf8.MatchHintText.Regex.Do.TrimText.Regex.Do.Resultregex_47KXx9dLqeO8MNJeizLKhPText.Regex.Base.RegexLike MatchArrayextractregex_D90DoxwgsTHEvoLrkciZPUText.Regex.PCRE.Wrap CompOption ExecOptionRegexpadpad'ExecBlankENotEmptyPartialCompBlankAnchoredCaselessDotall MultilineUtf8UngreedycompexecHintunhinthintPosLen_PosLen'AllOnceTestswap$fApplicativeAll$fApplicativeOnce $fHintPosLen_ $fHintPosLen' $fHintAll $fHintOnce $fHintTestEnc'val'enc'EncvalencUtf8_PosLen ReplacementBodyPattern ReplaceAccaccpos_adj GroupReplacer$fEnc'Replacementenc$fEnc'GroupReplacerenc $fEncUtf8_$fApplicativeUtf8_$fApplicativeReplacement$fApplicativeBody$fApplicativePattern$fFunctorReplaceAccToArraytoArray toByteString toByteString'toString $fToArray[]$fToArrayArrayRo_Opt_Rx_ makeRegex makeRegexOpt makeRegex' makeRegexOpt' KeepNeedleDropFrontEndreplacebreaksplitFormatformatMatchfHPmarray_poslen_R_onceall $fMatchfAllb $fMatchfOncebMatchmatch=~ MatchHintF$fMatchHintAllByteString$fMatchHintOnceByteString$fMatchHintPosLen_ByteString$fMatchHintPosLen'ByteString$fMatchHintTestByteString$fMatchHintAll[]$fMatchHintOnce[]$fMatchHintPosLen_[]$fMatchHintPosLen'[]$fMatchHintTest[]Extract'concat'len'prefixsuffix$fExtract'Text $fExtractText$fExtract'Utf8_$fExtractUtf8_$fExtract'ByteString $fExtract'[] ReplaceOpendefaultReplacergetGroup replaceMatchRepl_Replace'ReplaceTrimtrim$fTrim[]$fTrimByteStringpad_RegexSRegexB execBlank execNotEmpty execPartial compBlank compAnchored compCaseless compDotAll compMultilinecompUTF8 compUngreedycompOptexecOpt makeRegexOpts $fRegexRegex $fRegex[]$fRegexByteString $fRegexUtf8_break' breakFrontbreakEndsplit'splitEnd splitFront checkPattern $fFormat[] $fFormat[]0 CustomerFn foldFn_idx foldFn_map replaceOne foldr_idxfoldFnposlen allMatches groupMatchbaseGHC.BaseStringghc-prim GHC.TypesBool $fMatchab[] $fMatchab[]0 $fMatchab[]1 $fMatchabBool $fMatchab[]2bytes_6VWy06pWzJq9evDvK2d4w6Data.ByteString.Internal ByteStringExtractNothing firstGroup adjustPoslen$fReplaceOpen[]GroupReplacer$fReplaceOpenMaybeGroupReplacer$fReplaceOpen[]Replacement$fReplaceOpenMaybeReplacement$fReplace'Allareplb$fReplace'Onceareplb$fReplaceareplAllb$fReplaceareplOnceb$fReplaceaallbb$fReplaceallreplbb$fReplaceallreplBodybreplace'replace_dum_ replace_bs')$fReplace'AllUtf8_ByteStringGroupReplacer$fReplacebreplAllb$fReplacebreplOnceb$fReplaceballbb replace_str replace_bs*$fReplace'OnceUtf8_ByteStringGroupReplacer'$fReplace'AllUtf8_ByteStringReplacement($fReplace'OnceUtf8_ByteStringReplacement$fReplace'AllUtf8_[]Replacement $fReplace'OnceUtf8_[]Replacement$fMatchUtf8_ab[]$fMatchUtf8_ab[]0$fMatchUtf8_ab[]1$fMatchUtf8_abBool$fMatchUtf8_ab[]2mr_$fMatchHintTestUtf8_ByteString$fMatchHintOnceUtf8_[]$fMatchHintPosLen'Utf8_[]$fMatchHintAllUtf8_ByteString$fMatchHintOnceUtf8_ByteString!$fMatchHintPosLen_Utf8_ByteString!$fMatchHintPosLen'Utf8_ByteString$fMatchHintAllUtf8_[]$fMatchHintPosLen_Utf8_[]$fMatchHintTestUtf8_[]