q      !"#$%&'()*+,-./0123456789:;<=>?@ABC D E F G H I J K L M N O P Q R S T UVWX Y Z [ \ ] ^ _ ` a b c d e f g h i j klmnopSafe &)-3457N+pad String with Char to total length of Int pad on leftpad '-' 5 "abc" "--abc"  pad on rightpad' '-' 5 "abc""abc--" qqNone &)-3457NrsrsNone &)-3457N t uAn 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". vsee PCREPARTIAL(3) in  http://www.pcre.org/pcre.txtpcre man pages  http://www.pcre.org/pcre.txtpcre man pages wxthe 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. yBletters 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. zya 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 &)-3457Nalloncevaluesvalues!test: does body match pattern? !"#$%&  ! !&%$#"  !"#$%&Safe &)-3457N'Offset, Length*Haystack,Needle0#content with some replacements made1Sposition adjustment: group replacement length may differ from replaced text length 2see Text.Regex.Do.Pcre.ReplaceOpen defaultReplacer for example implementation '()*+,-./0123 '()*+,-./0123 23./01,-*+()''()*+,-./0123Safe &)-3457N6both Ascii and Utf87both Ascii and Utf84567894567674598456789None &)-3457N?tweak Regex with options :;<=>?@AB:;<=>? <=>BA@;:?:;<=>?@AB Safe &)-3457NC<see String, ByteString instances for implementation examplessee Text.Regex.Base.RegexLike for  detail CDEFGHIJKCDEFG CDEKJIHFGCDEFGHIJK None &)-3457NMneedle between parts disappearsN#needle sticks to front of next partO%needle sticks to end of previous partP;replace (Pattern "\n") (Replacement ",") (Body "a\nbc\nde")"a,bc,de" Q,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") R)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"] LMNOPQRLMNOPQRQPRLMNO LMNOPQR 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" STSTST STSafe &)-3457Nmatch offset, length all groupsmatches for one groupNone &)-3457Nmatched contentmatched contentNone &)-3457NUV covers all result typesGcompiler looks up the appropriate function depending on the result typeW is borrowed from Text.Regex.PCRE.Wrap, is a short version of V See also Text.Regex.Do.Pcre.MatchHint  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 UVWpatternbody?UVWUVW?UVW None&)-3457>LNXpicks U instance where , and * are of the same type and inferrable , or * 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)] XYZ[hint & patternbody4type defined by the instance, determined by the hint\]^_`abcdeXYZ[XYZ[edcba`_^]\ XYZ[\]^_`abcde Safe &)-3457Nf(:Sreplace (Just [(4,3)::PosLen]) (Replacement "4567") (Body "abc 123 def"::Body Text)"abc 4567 def"2 :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" hdReplaces specified (by idx) group match with tweaked value. Works for one common simple use case2# can be used with complicated regexnanother custom dynamic replacer could e.g. inspect all group matches before looking up a replacement. iget group content safelysee h source for use examplejcall from your custom 2 passed to  replaceGroupsee h source for use example fgh group idx"(group match -> replacement) tweakijreplaceable, unadjusted(new val, acc passed to 2)new accfghijfghij fghijNone &)-3457Nkdynamic group replace2custom replacer fn returns replacement value. See hreplacer::GroupReplacer String' replacer = defaultReplacer 1 tweak1* where tweak1 str1 = case str1 of5 "101" -> "[AB> >48=]"0 "3" -> "[three]"; otherwise -> trace str1 "?" vs  optionsJreplace (Once[]) (Pattern "\\w=(\\d{1,3})") replacer $ Body "a=101 b=3 12""a=[AB> >48=] b=3 12"Ireplace (All[]) (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.SplitRreplace (Once[Utf8]) (Pattern "<5=55") (Replacement "1>;55") $ Body "<5=55 <5=55" "1>;55 <5=55"Kreplace (Once[]) (Pattern "^a\\s") (Replacement "A") $ Body "a bc E>;.3>@.""Abc E>;.3>@." klklklklNone &)-3457Nm/removes leading and trailing spaces and tabs mnopmnmnpomnop !"#$%&'()*+,--..//00112345678899::;;<=>>?@ABCDEFGHIJKLM N O P Q R S T U V W X Y Z [ \ ] ^ _`ab c d a b e f g h i j k l m n o [ p q rs[tuvwxyz{|}~   regex_FUrXWQx28th7fpkFCaedbAText.Regex.Do.Type.ReexportText.Regex.Do.Pcre.MatchText.Regex.Do.PadText.Regex.Do.Pcre.OptionText.Regex.Do.Type.MatchHintText.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 ExecOptionRegexpadpad'ExecBlankENotEmptyPartialCompBlankAnchoredCaselessDotall MultilineUtf8UngreedycompexecHintunhintPosLen_PosLen'AllOnceTest $fHintPosLen_ $fHintPosLen' $fHintAll $fHintOnce $fHintTestPosLen ReplacementBodyPattern ReplaceAccaccpos_adj GroupReplacerToArraytoArray toByteStringtoString $fToArray[]$fToArrayArrayOpt_Rx_Regex_r_ropt_ makeRegexOpts $fRegex_Regex $fRegex_[]$fRegex_ByteStringExtract'concat'len'prefixsuffix$fExtract'Text $fExtractText$fExtract'ByteString $fExtract'[] KeepNeedleDropFrontEndreplacebreaksplitFormatformatMatchmatch=~ MatchHintF$fMatchHintAllByteString$fMatchHintOnceByteString$fMatchHintPosLen_ByteString$fMatchHintPosLen'ByteString$fMatchHintTestByteString$fMatchHintAll[]$fMatchHintOnce[]$fMatchHintPosLen_[]$fMatchHintPosLen'[]$fMatchHintTest[] ReplaceOpendefaultReplacergetGroup replaceMatchReplaceTrimtrim$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 ByteString Vanilla_all Vanilla_onceVanilla_Ro_rx' vanilla_once vanilla_all$fReplaceAllrxGroupReplacer[]$fReplaceOncerxGroupReplacer[]%$fReplaceAllrxGroupReplacerByteString&$fReplaceOncerxGroupReplacerByteString#$fReplaceAllrxReplacementByteString$$fReplaceOncerxReplacementByteString$fReplaceAllrxReplacement[]$fReplaceOncerxReplacement[]