G B)$g55.5.0+dev0-2025-04-28/#Str®expA;@@@A@@@@@;../../otherlibs/str/str.mliZEEZEP@@@@#Str@@A@®exp@&string4@@@#Str5®exp@@@@@@^^@@A@@0regexp_case_fold@6@@@#Str7®exp@@@@@@3N||4N|@@2B@@%quote@18@@@69@@@@@@HSLLISLh@@GC@@-regexp_string@F:@@@#Str;®exp@@@@@@`WaW@@_D@@7regexp_string_case_fold@^<@@@#Str=®exp@@@@@@x[RRy[R@@wE@@,string_match@#Str>®exp@@@@?@@@@#int@@@@$boolA@@@@@@@@@@c,,c,^@@F@@.search_forward@#StrB®exp@@@@C@@@@(D@@@-E@@@@@@@@@@h''h'Z@@G@@/search_backward@#StrF®exp@@@@G@@@@NH@@@SI@@@@@@@@@@pp@@H@@4string_partial_match@#StrJ®exp@@@@K@@@@tL@@@sM@@@@@@@@@@x++x+e@@I@@.matched_string@N@@@O@@@@@@'}(}=@@&J@@/match_beginning@$unitP@@@Q@@@@@@=> @@@@N@@)group_end!@Y@@@Z@@@@@@   !@@O@@.global_replace"@#Str[®exp@@@@\@@@@]@@@^@@@@@@@@@@####=@@P@@-replace_first#@#Str_®exp@@@@`@@@@a@@@b@@@@@@@@@@$$$%@@Q@@1global_substitute$@#Strc®exp@@@@@d@@@e@@@@@@f@@@g@@@@@@@@@@%%%%@@R@@0substitute_first%@#Strh®exp@@@@@i@@@ j@@@@@@'k@@@,l@@@@@@@@@@>' ' ?' 'S@@=S@@/replace_matched&@<m@@@@Cn@@@Ho@@@@@@@@Z''['(@@YT@@%split'@#Strp®exp@@@@bq@@@$listsmr@@@@@@@@@@ @))))@@U@@-bounded_split(@#Strt®exp@@@ @u@@@ @v@@@ -xw@@@ @@@@@@@@@@++++P@@V@@+split_delim)@#Stry®exp@@@@z@@@R|{@@@@@@@@@@@++++@@W@@3bounded_split_delim*@#Str}®exp@@@@~@@@@Y@@@~@@@@@@@@ @@!@@"@-2-2-2-r@@X@@,split_result+B;@@$Text,@@@#@@ .>.B .>.P@@Z@%Delim-@@@$@@! .Q.S" .Q.d@@ [@@@A@@@@@%.*.*@@@@#Y@A@*full_split.@#Str®exp@@@.@,@@@/#Str,split_result@@@0@@@2@@3@@4@L .f.fM .f.@@K\@@2bounded_full_split/@#Str®exp@@@5@T@@@6@@@@7#Str,split_result@@@8@@@:@@;@@<@@=@{//|/0@@z]@@-string_before0@y@@@>@@@@?@@@@@@A@@B@1111B@@^@@,string_after1@@@@C@@@@D@@@E@@F@@G@#11#12@@_@@+first_chars2@@@@H@1@@@I@@@J@@K@@L@(22(22@@`@@*last_chars3@@@@M@M@@@N@@@O@@P@@Q@,3;3;,3;3c@@a@@@3 4Regular expressions and high-level string processing@@@@@@@@@@@@A;../../otherlibs/str/str.mliA@3Regular expressions@@$The  @@ y library provides regular expressions on sequences of bytes. It is, in general, unsuitable to match Unicode characters.@#*Str.regexp3 )The type of compiled regular expressions.@@@@@@@@@@@@@@A@@@@*Str.regexp3 JCompile a regular expression. The following constructs are recognized:&. & Matches any character except newline.@&* T (postfix) Matches the preceding expression zero, one or several times@&+ N (postfix) Matches the preceding expression one or several times@&? L (postfix) Matches the preceding expression once or not at all@&[..] ( Character set. Ranges are denoted with !-(, as in %[a-z];. An initial !^(, as in &[^0-9] 2, complements the set. To include a !] X character in a set, make it the first character of the set. To include a !- V character in a set, make it the first or the last character of the set.@&^ { Matches at beginning of line: either at the beginning of the matched string, or just after a '\n' character.@&$ p Matches at end of line: either at the end of the matched string, or just before a '\n' character.@&\| - (infix) Alternative between two expressions.@&\(..\) 0 Grouping and naming of the enclosed expression.@&\1 ? The text matched by the first '\(...\)2 expression ("\2 , for the second expression, and so on up to "\9").@&\b 9 Matches word boundaries.@&\ F Quotes special characters. The special characters are )$^\.*+?[]!.@@ r In regular expressions you will often use backslash characters; it's easier to use a quoted string literal '{|...|} * to avoid having to escape backslashes.@ . For example, the following expression: ^ let r = Str.regexp {|hello \([A-Za-z]+\)|} in Str.replace_first r {|\1|} "hello world" 7 returns the string '"world"!.@ k If you want a regular expression that matches a literal backslash character, you need to double it: 1Str.regexp {|\\|}!.@ ( You can use regular string literals %"..." too, however you will have to escape backslashes. The example above can be rewritten with a regular string literal as: ] let r = Str.regexp "hello \\([A-Za-z]+\\)" in Str.replace_first r "\\1" "hello world" @ Z And the regular expression for matching a backslash becomes a quadruple backslash: 1Str.regexp "\\\\"!.@@@@@@@@@@@@@ @@@@נ4Str.regexp_case_fold3(Same as ®exp , but the compiled expression will match text in a case-insensitive way: uppercase and lowercase letters will be considered equivalent.@@@@@@@@@@@@@@@@@Ԡ)Str.quote3+Str.quote s 1 returns a regexp string that matches exactly !s2 and nothing else.@@@@@@@@@@@@@.@@@@נ1Str.regexp_string33Str.regexp_string s 6 returns a regular expression that matches exactly !s2 and nothing else.@@@@@@@@@@@@@F@@@@נ;Str.regexp_string_case_fold3;Str.regexp_string_case_fold/ is similar to $D@ 6, but the regexp matches in a case-insensitive way.@@@@@@@@@@@@@^@@@@נA@=String matching and searching@@0Str.string_match36string_match r s start> tests whether a substring of !s< that starts at position %start matches the regular expression !r 2. The first character of a string has position !0+, as usual.@@@@@@@@@@@@@@@@@@@栕2Str.search_forward38search_forward r s start5 searches the string !s 4 for a substring matching the regular expression !r #. The search starts at position %start w and proceeds towards the end of the string. Return the position of the first character of the matched substring.@@@@@@@@)Not_found8if no substring matches.@@@@@@@@@@@@3Str.search_backward38search_backward r s last5 searches the string !s 3 for a substring matching the regular expression !r A. The search first considers substrings that start at position $last w and proceeds towards the beginning of string. Return the position of the first character of the matched substring.@@@@@@@@)Not_found8if no substring matches.@@@@@ @ @@@@@@8Str.string_partial_match3+Similar to D@ , but also returns true if the argument string is a prefix of a string that matches. This includes the case of a true complete match.@@@@@@@@@@@@@ @ @@@@@2Str.matched_string30matched_string s: returns the substring of !s a that was matched by the last call to one of the following matching or searching functions:D@@D@@hD@@@A@@@@Ġ3Str.group_beginning31group_beginning n Y returns the position of the first character of the substring that was matched by the !n tth group of the regular expression that was matched by the last call to a matching or searching function (see CD@. for details).@@@@@@@@)Not_found'if the !n 6th group of the regular expression was not matched.@0Invalid_argument8if there are fewer than !n % groups in the regular expression.@@@@@@w@@@@堕-Str.group_end3+group_end n o returns the position of the character following the last character of substring that was matched by the !n tth group of the regular expression that was matched by the last call to a matching or searching function (see yD@. for details).@@@@@@@@)Not_found'if the !n 6th group of the regular expression was not matched.@0Invalid_argument8if there are fewer than !n % groups in the regular expression.@@@@@ @@@@@A@+Replacement@@p3=global_replace regexp templ s? returns a string identical to !s #, except that all substrings of !s, that match ®exp: have been replaced by %templ;. The replacement template %templ0 can contain "\1", "\2 x, etc; these sequences will be replaced by the text matched by the corresponding group in the regular expression. "\0 = stands for the text matched by the whole regular expression.@@@@@@@@@@@@@@A@:@6@@@@.3(Same as D@ V, except that only the first substring matching the regular expression is replaced.@@@@@@@@@@@@4@5@.@*@@@@"3 global_substitute regexp subst s " returns a string identical to !s , except that all substrings of !s, that match ®exp 1 have been replaced by the result of function %subst2. The function %subst = is called once for each matching substring, and receives !s> (the whole text) as argument.@@@@@@@@@@@@I@JJ@MC@P8@@@@03(Same as #D@ V, except that only the first substring matching the regular expression is replaced.@@@@@@@@@@@@6@d7@g0@j%@@@@3Str.replace_matched36replace_matched repl s> returns the replacement text $repl- in which "\1", "\2 , etc. have been replaced by the text matched by the corresponding groups in the regular expression that was matched by the last call to a matching or searching function (see xD@2 for details). !s R must be the same string that was passed to the matching or searching function.@@@@@@@@@@@@?@@@<@@@@4A@)Splitting@@V3)split r s( splits !s D into substrings, taking as delimiters the substrings that match !r 7, and returns the list of substrings. For instance, 9split (regexp "[ \t]+") s( splits !s { into blank-separated words. An occurrence of the delimiter at the beginning or at the end of the string is ignored.@@@@@@@@@@@@V@W@P@@@@A}3(Same as D@:, but splits into at most !n6 substrings, where !n is the extra integer parameter.@@@@@@@@@@@@S@T@M@I@@@@;3(Same as D@ but occurrences of the delimiter at the beginning and at the end of the string are recognized and returned as empty strings in the result. For instance, split_delim (regexp " ") " abc ", returns /[""; "abc"; ""](, while %split $ with the same arguments returns '["abc"]!.@@@@@@@@@@@@Y@"Z@%S@@@@EȐ3(Same as ڐD@ , but occurrences of the delimiter at the beginning and at the end of the string are recognized and returned as empty strings in the result.@@@@@@@@@@@@K@9L@<E@?A@@@@3#0Str.split_result@@-,@@@"!@@@@A@@@@3(Same as D@ r, but returns the delimiters as well as the substrings contained between delimiters. The former are tagged %Delim . in the result list; the latter are tagged $Text4. For instance, !full_split (regexp "[{}]") "{ab}", returns ![Delim "{"; Text "ab"; Delim "}"]!.@@@@@@@@@@@@:@{;@~4@@@@#3(Same as )D@ r, but returns the delimiters as well as the substrings contained between delimiters. The former are tagged %Delim . in the result list; the latter are tagged $Text!.@@@@@@@@@@@@5@6@/@+@@@@A@5Extracting substrings@@1Str.string_before31string_before s n , returns the substring of all characters of !s: that precede position !n ) (excluding the character at position !n").@@@@@@@@@@@@7@8@4@@@@,0Str.string_after30string_after s n , returns the substring of all characters of !s9 that follow position !n ) (including the character at position !n").@@@@@@@@@@@@B@C@?@@@@7/Str.first_chars3/first_chars s n3 returns the first !n/ characters of !s ". This is the same function as fD@!.@@@@@@@@@@@@M@N@ J@@@@B.Str.last_chars3.last_chars s n2 returns the last !n/ characters of !s!.@@@@@@@@@@@@R@>S@AO@@@@G@@A@@A@@@@@