rregex 1.10.11 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cf.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Escapes all regular expression meta characters in `text`.
5
- *
6
- * The string returned may be safely used as a literal in a regular
7
- * expression.
8
- * @param {string} text
9
- * @returns {string}
10
- */
4
+ * Escapes all regular expression meta characters in `text`.
5
+ *
6
+ * The string returned may be safely used as a literal in a regular
7
+ * expression.
8
+ */
11
9
  export function escape(text: string): string;
12
10
  /**
13
11
  * Represents a single match of a regex in a haystack.
@@ -660,593 +658,588 @@ export type Capture = {
660
658
  }
661
659
 
662
660
  /**
663
- * A compiled regular expression for matching Unicode strings.
664
- *
665
- * A `RRegex` can be used to search haystacks, split haystacks into substrings
666
- * or replace substrings in a haystack with a different substring. All
667
- * searching is done with an implicit `(?s:.)*?` at the beginning and end of
668
- * an pattern. To force an expression to match the whole string (or a prefix
669
- * or a suffix), you must use an anchor like `^` or `$` (or `\A` and `\z`).
670
- *
671
- * While this library will handle Unicode strings (whether in the regular
672
- * expression or in the haystack), all positions returned are **byte
673
- * offsets**. Every byte offset is guaranteed to be at a Unicode code point
674
- * boundary. That is, all offsets returned by the `RRegex` API are guaranteed
675
- * to be ranges that can slice an `Uint8Array` created with a TextEncoder.
676
- *
677
- * # Example: slicing over UTF strings
678
- *
679
- * ```typescript
680
- * import { RRegex } from "rregex"
681
- *
682
- * const re = new RRegex("ä")
683
- * const m = re.find("äöü") // { start: 0, end: 2 }
684
- *
685
- * const buff = new TextEncoder().encode("äöü")
686
- * const slice = buff.slice(m.start, m.end)
687
- * expect(new TextDecoder().decode(slice)).toBe("ä")
688
- * ```
689
- *
690
- * # Example: find the offsets of a US phone number:
691
- *
692
- * ```typescript
693
- * import { RRegex } from "rregex"
694
- *
695
- * const re = new RRegex("[0-9]{3}-[0-9]{3}-[0-9]{4}");
696
- * const m = re.find("phone: 111-222-3333");
697
- * expect(m.start).toBe(7);
698
- * expect(m.end).toBe(19);
699
- * ```
700
- *
701
- * @see https://docs.rs/regex/latest/regex/
702
- */
661
+ * A compiled regular expression for matching Unicode strings.
662
+ *
663
+ * A `RRegex` can be used to search haystacks, split haystacks into substrings
664
+ * or replace substrings in a haystack with a different substring. All
665
+ * searching is done with an implicit `(?s:.)*?` at the beginning and end of
666
+ * an pattern. To force an expression to match the whole string (or a prefix
667
+ * or a suffix), you must use an anchor like `^` or `$` (or `\A` and `\z`).
668
+ *
669
+ * While this library will handle Unicode strings (whether in the regular
670
+ * expression or in the haystack), all positions returned are **byte
671
+ * offsets**. Every byte offset is guaranteed to be at a Unicode code point
672
+ * boundary. That is, all offsets returned by the `RRegex` API are guaranteed
673
+ * to be ranges that can slice an `Uint8Array` created with a TextEncoder.
674
+ *
675
+ * # Example: slicing over UTF strings
676
+ *
677
+ * ```typescript
678
+ * import { RRegex } from "rregex"
679
+ *
680
+ * const re = new RRegex("ä")
681
+ * const m = re.find("äöü") // { start: 0, end: 2 }
682
+ *
683
+ * const buff = new TextEncoder().encode("äöü")
684
+ * const slice = buff.slice(m.start, m.end)
685
+ * expect(new TextDecoder().decode(slice)).toBe("ä")
686
+ * ```
687
+ *
688
+ * # Example: find the offsets of a US phone number:
689
+ *
690
+ * ```typescript
691
+ * import { RRegex } from "rregex"
692
+ *
693
+ * const re = new RRegex("[0-9]{3}-[0-9]{3}-[0-9]{4}");
694
+ * const m = re.find("phone: 111-222-3333");
695
+ * expect(m.start).toBe(7);
696
+ * expect(m.end).toBe(19);
697
+ * ```
698
+ *
699
+ * @see https://docs.rs/regex/latest/regex/
700
+ */
703
701
  export class RRegex {
704
702
  free(): void;
705
- /**
706
- * Compiles a regular expression. Once compiled, it can be used repeatedly
707
- * to search, split or replace text in a string.
708
- *
709
- * If an invalid expression is given, then an error is returned.
710
- * @param {string} re
711
- */
703
+ /**
704
+ * Compiles a regular expression. Once compiled, it can be used repeatedly
705
+ * to search, split or replace text in a string.
706
+ *
707
+ * If an invalid expression is given, then an error is returned.
708
+ */
712
709
  constructor(re: string);
713
- /**
714
- * Returns true if and only if there is a match for the regex in the
715
- * string given.
716
- *
717
- * It is recommended to use this method if all you need to do is test
718
- * a match, since the underlying matching engine may be able to do less
719
- * work.
720
- *
721
- * # Example
722
- *
723
- * Test if some text contains at least one word with exactly 13
724
- * Unicode word characters:
725
- *
726
- * ```typescript
727
- * import { RRegex } from "rregex"
728
- *
729
- * const text = "I categorically deny having triskaidekaphobia."
730
- * expect(new RRegex("\\b\\w{13}\\b").is_match(text)).toBe(true)
731
- * ```
732
- *
733
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
734
- * @param {string} text - The string against which to match the regular expression
735
- * @return {boolean}
736
- */
710
+ /**
711
+ * Returns true if and only if there is a match for the regex in the
712
+ * string given.
713
+ *
714
+ * It is recommended to use this method if all you need to do is test
715
+ * a match, since the underlying matching engine may be able to do less
716
+ * work.
717
+ *
718
+ * # Example
719
+ *
720
+ * Test if some text contains at least one word with exactly 13
721
+ * Unicode word characters:
722
+ *
723
+ * ```typescript
724
+ * import { RRegex } from "rregex"
725
+ *
726
+ * const text = "I categorically deny having triskaidekaphobia."
727
+ * expect(new RRegex("\\b\\w{13}\\b").is_match(text)).toBe(true)
728
+ * ```
729
+ *
730
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
731
+ * @param {string} text - The string against which to match the regular expression
732
+ * @return {boolean}
733
+ */
737
734
  isMatch(text: string): boolean;
738
- /**
739
- * Returns the same as is_match, but starts the search at the given offset.
740
- * The significance of the starting point is that it takes the surrounding
741
- * context into consideration. For example, the `\A` anchor can only match
742
- * when `start == 0`.
743
- *
744
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
745
- * @param {string} text - The string against which to match the regular expression
746
- * @param {number} start - Zero-based index at which to start matching
747
- * @return {boolean}
748
- */
735
+ /**
736
+ * Returns the same as is_match, but starts the search at the given offset.
737
+ * The significance of the starting point is that it takes the surrounding
738
+ * context into consideration. For example, the `\A` anchor can only match
739
+ * when `start == 0`.
740
+ *
741
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
742
+ * @param {string} text - The string against which to match the regular expression
743
+ * @param {number} start - Zero-based index at which to start matching
744
+ * @return {boolean}
745
+ */
749
746
  isMatchAt(text: string, start: number): boolean;
750
- /**
751
- * Returns the start and end byte range of the leftmost-first match in
752
- * `text`. If no match exists, then `undefined` is returned.
753
- *
754
- * Note that this should only be used if you want to discover the position
755
- * of the match. Testing the existence of a match is faster if you use
756
- * `isMatch`.
757
- *
758
- * # Example
759
- *
760
- * Find the start and end location of the first word with exactly 13
761
- * Unicode word characters:
762
- *
763
- * ```typescript
764
- * import { RRegex } from "rregex"
765
- *
766
- * const text = "I categorically deny having triskaidekaphobia."
767
- * const m = new RRegex("\\b\\w{13}\\b").find(text)
768
- * expect(m.start).toBe(2)
769
- * expect(m.end).toBe(15)
770
- * ```
771
- *
772
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
773
- * @param {string} text - The string against which to match the regular expression
774
- * @return {Match}
775
- */
747
+ /**
748
+ * Returns the start and end byte range of the leftmost-first match in
749
+ * `text`. If no match exists, then `undefined` is returned.
750
+ *
751
+ * Note that this should only be used if you want to discover the position
752
+ * of the match. Testing the existence of a match is faster if you use
753
+ * `isMatch`.
754
+ *
755
+ * # Example
756
+ *
757
+ * Find the start and end location of the first word with exactly 13
758
+ * Unicode word characters:
759
+ *
760
+ * ```typescript
761
+ * import { RRegex } from "rregex"
762
+ *
763
+ * const text = "I categorically deny having triskaidekaphobia."
764
+ * const m = new RRegex("\\b\\w{13}\\b").find(text)
765
+ * expect(m.start).toBe(2)
766
+ * expect(m.end).toBe(15)
767
+ * ```
768
+ *
769
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
770
+ * @param {string} text - The string against which to match the regular expression
771
+ * @return {Match}
772
+ */
776
773
  find(text: string): Match | undefined;
777
- /**
778
- * Returns the same as find, but starts the search at the given
779
- * offset.
780
- *
781
- * The significance of the starting point is that it takes the surrounding
782
- * context into consideration. For example, the `\A` anchor can only
783
- * match when `start == 0`.
784
- *
785
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
786
- * @param {string} text - The string against which to match the regular expression
787
- * @param {number} start - Zero-based index at which to start matching
788
- * @returns {Match}
789
- */
774
+ /**
775
+ * Returns the same as find, but starts the search at the given
776
+ * offset.
777
+ *
778
+ * The significance of the starting point is that it takes the surrounding
779
+ * context into consideration. For example, the `\A` anchor can only
780
+ * match when `start == 0`.
781
+ *
782
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
783
+ * @param {string} text - The string against which to match the regular expression
784
+ * @param {number} start - Zero-based index at which to start matching
785
+ * @returns {Match}
786
+ */
790
787
  findAt(text: string, start: number): Match | undefined;
791
- /**
792
- * Returns an array for each successive non-overlapping match in `text``,
793
- * returning the start and end byte indices with respect to `text`.
794
- *
795
- * # Example
796
- *
797
- * Find the start and end location of every word with exactly 13 Unicode
798
- * word characters:
799
- *
800
- * ```typescript
801
- * import { RRegex } from "rregex"
802
- *
803
- * const text = "Retroactively relinquishing remunerations is reprehensible."
804
- * const matches = new RRegex("\\b\\w{13}\\b").findAll(text)
805
- * ```
806
- *
807
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
808
- * @param {string} text - The string against which to match the regular expression
809
- * @returns {Match}
810
- */
788
+ /**
789
+ * Returns an array for each successive non-overlapping match in `text``,
790
+ * returning the start and end byte indices with respect to `text`.
791
+ *
792
+ * # Example
793
+ *
794
+ * Find the start and end location of every word with exactly 13 Unicode
795
+ * word characters:
796
+ *
797
+ * ```typescript
798
+ * import { RRegex } from "rregex"
799
+ *
800
+ * const text = "Retroactively relinquishing remunerations is reprehensible."
801
+ * const matches = new RRegex("\\b\\w{13}\\b").findAll(text)
802
+ * ```
803
+ *
804
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
805
+ * @param {string} text - The string against which to match the regular expression
806
+ * @returns {Match}
807
+ */
811
808
  findAll(text: string): Match[];
812
- /**
813
- * Returns a list of the capture names in this regex.
814
- *
815
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.capture_names
816
- */
809
+ /**
810
+ * Returns a list of the capture names in this regex.
811
+ *
812
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.capture_names
813
+ */
817
814
  captureNames(): (string | null)[];
818
- /**
819
- * Returns the capture groups corresponding to the leftmost-first
820
- * match in `text`. Capture group `0` always corresponds to the entire
821
- * match. If no match is found, then `undefined` is returned.
822
- *
823
- * You should only use `captures` if you need access to the location of
824
- * capturing group matches. Otherwise, `find` is faster for discovering
825
- * the location of the overall match.
826
- *
827
- * # Examples
828
- *
829
- * Say you have some text with movie names and their release years,
830
- * like "'Citizen Kane' (1941)". It'd be nice if we could search for text
831
- * looking like that, while also extracting the movie name and its release
832
- * year separately.
833
- *
834
- * ```typescript
835
- * import { RRegex } from "rregex"
836
- *
837
- * const re = new RRegex("'([^']+)'\\s+\\((\\d{4})\)")
838
- * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
839
- * const caps = re.captures(text)
840
- * expect(caps.get[1].value).toBe("Citizen Kane")
841
- * expect(caps.get[2].value).toBe("1941")
842
- * expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
843
- * ```
844
- *
845
- * Note that the full match is at capture group `0`. Each subsequent
846
- * capture group is indexed by the order of its opening `(`.
847
- *
848
- * We can make this example a bit clearer by using *named* capture groups:
849
- *
850
- * ```typescript
851
- * import { RRegex } from "rregex"
852
- *
853
- * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\)")
854
- * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
855
- * const caps = re.captures(text)
856
- * expect(caps.name["title"].value).toBe("Citizen Kane")
857
- * expect(caps.name["year"].value).toBe("1941")
858
- * expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
859
- * ```
860
- *
861
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures
862
- * @param {string} text - The string against which to match the regular expression
863
- * @returns {Captures|undefined}
864
- */
815
+ /**
816
+ * Returns the capture groups corresponding to the leftmost-first
817
+ * match in `text`. Capture group `0` always corresponds to the entire
818
+ * match. If no match is found, then `undefined` is returned.
819
+ *
820
+ * You should only use `captures` if you need access to the location of
821
+ * capturing group matches. Otherwise, `find` is faster for discovering
822
+ * the location of the overall match.
823
+ *
824
+ * # Examples
825
+ *
826
+ * Say you have some text with movie names and their release years,
827
+ * like "'Citizen Kane' (1941)". It'd be nice if we could search for text
828
+ * looking like that, while also extracting the movie name and its release
829
+ * year separately.
830
+ *
831
+ * ```typescript
832
+ * import { RRegex } from "rregex"
833
+ *
834
+ * const re = new RRegex("'([^']+)'\\s+\\((\\d{4})\)")
835
+ * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
836
+ * const caps = re.captures(text)
837
+ * expect(caps.get[1].value).toBe("Citizen Kane")
838
+ * expect(caps.get[2].value).toBe("1941")
839
+ * expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
840
+ * ```
841
+ *
842
+ * Note that the full match is at capture group `0`. Each subsequent
843
+ * capture group is indexed by the order of its opening `(`.
844
+ *
845
+ * We can make this example a bit clearer by using *named* capture groups:
846
+ *
847
+ * ```typescript
848
+ * import { RRegex } from "rregex"
849
+ *
850
+ * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\)")
851
+ * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
852
+ * const caps = re.captures(text)
853
+ * expect(caps.name["title"].value).toBe("Citizen Kane")
854
+ * expect(caps.name["year"].value).toBe("1941")
855
+ * expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
856
+ * ```
857
+ *
858
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures
859
+ * @param {string} text - The string against which to match the regular expression
860
+ * @returns {Captures|undefined}
861
+ */
865
862
  captures(text: string): Captures | undefined;
866
- /**
867
- * Returns a list with all the non-overlapping capture groups matched
868
- * in `text`. This is operationally the same as `findAll`, except it
869
- * returns information about capturing group matches.
870
- *
871
- * # Example
872
- *
873
- * We can use this to find all movie titles and their release years in
874
- * some text, where the movie is formatted like "'Title' (xxxx)":
875
- *
876
- * ```typescript
877
- * import { RRegex } from "rregex"
878
- *
879
- * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\\)")
880
- * const text = "'Citizen Kane' (1941), 'The Wizard of Oz' (1939), 'M' (1931)."
881
- * for caps of re.captures_iter(text) {
882
- * console.log(
883
- * "Movie:", caps.name["title"].value, ","
884
- * "Released:", caps.name["year"].value
885
- * );
886
- * }
887
- * // Output:
888
- * // Movie: Citizen Kane, Released: 1941
889
- * // Movie: The Wizard of Oz, Released: 1939
890
- * // Movie: M, Released: 1931
891
- * ```
892
- *
893
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_iter
894
- * @param {string} text - The string against which to match the regular expression
895
- * @returns {Captures[]}
896
- */
863
+ /**
864
+ * Returns a list with all the non-overlapping capture groups matched
865
+ * in `text`. This is operationally the same as `findAll`, except it
866
+ * returns information about capturing group matches.
867
+ *
868
+ * # Example
869
+ *
870
+ * We can use this to find all movie titles and their release years in
871
+ * some text, where the movie is formatted like "'Title' (xxxx)":
872
+ *
873
+ * ```typescript
874
+ * import { RRegex } from "rregex"
875
+ *
876
+ * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\\)")
877
+ * const text = "'Citizen Kane' (1941), 'The Wizard of Oz' (1939), 'M' (1931)."
878
+ * for caps of re.captures_iter(text) {
879
+ * console.log(
880
+ * "Movie:", caps.name["title"].value, ","
881
+ * "Released:", caps.name["year"].value
882
+ * );
883
+ * }
884
+ * // Output:
885
+ * // Movie: Citizen Kane, Released: 1941
886
+ * // Movie: The Wizard of Oz, Released: 1939
887
+ * // Movie: M, Released: 1931
888
+ * ```
889
+ *
890
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_iter
891
+ * @param {string} text - The string against which to match the regular expression
892
+ * @returns {Captures[]}
893
+ */
897
894
  capturesAll(text: string): Captures[];
898
- /**
899
- * Returns the number of captures.
900
- *
901
- * This includes all named and unnamed groups, including the implicit
902
- * unnamed group that is always present and corresponds to the entire match.
903
- *
904
- * Since the implicit unnamed group is always included in this length, the
905
- * length returned is guaranteed to be greater than zero.
906
- *
907
- * ## Example
908
- *
909
- * ```typescript
910
- * import { RRegex } from "rregex"
911
- *
912
- * const re1 = new RRegex("(?P<y>\\d{4})-(?P<m>\\d{2})-(?P<d>\\d{2})")
913
- * expect(re1.capturesLength()).toEqual(4)
914
- *
915
- * const re2 = new RRegex("foo")
916
- * expect(re2.capturesLength()).toEqual(1)
917
- *
918
- * const re3 = new RRegex("(foo)")
919
- * expect(re3.capturesLength()).toEqual(2)
920
- *
921
- * const re4 = new RRegex("(?<a>.(?<b>.))(.)(?:.)(?<c>.)")
922
- * expect(re4.capturesLength()).toEqual(5)
923
- *
924
- * const re5 = new RRegex("[a&&b]")
925
- * expect(re5.capturesLength()).toEqual(1)
926
- * ```
927
- *
928
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_len
929
- * @returns {number}
930
- */
895
+ /**
896
+ * Returns the number of captures.
897
+ *
898
+ * This includes all named and unnamed groups, including the implicit
899
+ * unnamed group that is always present and corresponds to the entire match.
900
+ *
901
+ * Since the implicit unnamed group is always included in this length, the
902
+ * length returned is guaranteed to be greater than zero.
903
+ *
904
+ * ## Example
905
+ *
906
+ * ```typescript
907
+ * import { RRegex } from "rregex"
908
+ *
909
+ * const re1 = new RRegex("(?P<y>\\d{4})-(?P<m>\\d{2})-(?P<d>\\d{2})")
910
+ * expect(re1.capturesLength()).toEqual(4)
911
+ *
912
+ * const re2 = new RRegex("foo")
913
+ * expect(re2.capturesLength()).toEqual(1)
914
+ *
915
+ * const re3 = new RRegex("(foo)")
916
+ * expect(re3.capturesLength()).toEqual(2)
917
+ *
918
+ * const re4 = new RRegex("(?<a>.(?<b>.))(.)(?:.)(?<c>.)")
919
+ * expect(re4.capturesLength()).toEqual(5)
920
+ *
921
+ * const re5 = new RRegex("[a&&b]")
922
+ * expect(re5.capturesLength()).toEqual(1)
923
+ * ```
924
+ *
925
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_len
926
+ */
931
927
  capturesLength(): number;
932
- /**
933
- * Replaces the leftmost-first match with the replacement provided.
934
- * The replacement can be a regular string (where `$N` and `$name` are
935
- * expanded to match capture groups) or a function that takes the matches'
936
- * `Captures` and returns the replaced string.
937
- *
938
- * If no match is found, then a copy of the string is returned unchanged.
939
- *
940
- * # Replacement string syntax
941
- *
942
- * All instances of `$name` in the replacement text is replaced with the
943
- * corresponding capture group `name`.
944
- *
945
- * `name` may be an integer corresponding to the index of the
946
- * capture group (counted by order of opening parenthesis where `0` is the
947
- * entire match) or it can be a name (consisting of letters, digits or
948
- * underscores) corresponding to a named capture group.
949
- *
950
- * If `name` isn't a valid capture group (whether the name doesn't exist
951
- * or isn't a valid index), then it is replaced with the empty string.
952
- *
953
- * The longest possible name is used. e.g., `$1a` looks up the capture
954
- * group named `1a` and not the capture group at index `1`. To exert more
955
- * precise control over the name, use braces, e.g., `${1}a`.
956
- *
957
- * To write a literal `$` use `$$`.
958
- *
959
- * # Examples
960
- *
961
- * Note that this function is polymorphic with respect to the replacement.
962
- * In typical usage, this can just be a normal string:
963
- *
964
- * ```typescript
965
- * import { RRegex } from "rregex"
966
- *
967
- * const re = new RRegex("[^01]+")
968
- * expect(re.replace("1078910", "").toBe("1010")
969
- * ```
970
- *
971
- * Here's the example using this expansion technique with named capture
972
- * groups:
973
- *
974
- * ```typescript
975
- * import { RRegex } from "rregex"
976
- *
977
- * const re = new RRegex("(?P<last>[^,\\s]+),\\s+(?P<first>\\S+)")
978
- * const result = re.replace("Springsteen, Bruce", "$first $last")
979
- * expect(result).toBe("Bruce Springsteen")
980
- * ```
981
- *
982
- * Note that using `$2` instead of `$first` or `$1` instead of `$last`
983
- * would produce the same result. To write a literal `$` use `$$`.
984
- *
985
- * Sometimes the replacement string requires use of curly braces to
986
- * delineate a capture group replacement and surrounding literal text.
987
- * For example, if we wanted to join two words together with an
988
- * underscore:
989
- *
990
- * ```typescript
991
- * import { RRegex } from "rregex"
992
- *
993
- * const re = new RRegex("(?P<first>\\w+)\\s+(?P<second>\\w+)")
994
- * const result = re.replace("deep fried", "${first}_$second")
995
- * expect(result).toBe("deep_fried")
996
- * ```
997
- *
998
- * Without the curly braces, the capture group name `first_` would be
999
- * used, and since it doesn't exist, it would be replaced with the empty
1000
- * string.
1001
- *
1002
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
1003
- * @param {string} text - The string against which to match the regular expression
1004
- * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
1005
- * @returns {string}
1006
- */
928
+ /**
929
+ * Replaces the leftmost-first match with the replacement provided.
930
+ * The replacement can be a regular string (where `$N` and `$name` are
931
+ * expanded to match capture groups) or a function that takes the matches'
932
+ * `Captures` and returns the replaced string.
933
+ *
934
+ * If no match is found, then a copy of the string is returned unchanged.
935
+ *
936
+ * # Replacement string syntax
937
+ *
938
+ * All instances of `$name` in the replacement text is replaced with the
939
+ * corresponding capture group `name`.
940
+ *
941
+ * `name` may be an integer corresponding to the index of the
942
+ * capture group (counted by order of opening parenthesis where `0` is the
943
+ * entire match) or it can be a name (consisting of letters, digits or
944
+ * underscores) corresponding to a named capture group.
945
+ *
946
+ * If `name` isn't a valid capture group (whether the name doesn't exist
947
+ * or isn't a valid index), then it is replaced with the empty string.
948
+ *
949
+ * The longest possible name is used. e.g., `$1a` looks up the capture
950
+ * group named `1a` and not the capture group at index `1`. To exert more
951
+ * precise control over the name, use braces, e.g., `${1}a`.
952
+ *
953
+ * To write a literal `$` use `$$`.
954
+ *
955
+ * # Examples
956
+ *
957
+ * Note that this function is polymorphic with respect to the replacement.
958
+ * In typical usage, this can just be a normal string:
959
+ *
960
+ * ```typescript
961
+ * import { RRegex } from "rregex"
962
+ *
963
+ * const re = new RRegex("[^01]+")
964
+ * expect(re.replace("1078910", "").toBe("1010")
965
+ * ```
966
+ *
967
+ * Here's the example using this expansion technique with named capture
968
+ * groups:
969
+ *
970
+ * ```typescript
971
+ * import { RRegex } from "rregex"
972
+ *
973
+ * const re = new RRegex("(?P<last>[^,\\s]+),\\s+(?P<first>\\S+)")
974
+ * const result = re.replace("Springsteen, Bruce", "$first $last")
975
+ * expect(result).toBe("Bruce Springsteen")
976
+ * ```
977
+ *
978
+ * Note that using `$2` instead of `$first` or `$1` instead of `$last`
979
+ * would produce the same result. To write a literal `$` use `$$`.
980
+ *
981
+ * Sometimes the replacement string requires use of curly braces to
982
+ * delineate a capture group replacement and surrounding literal text.
983
+ * For example, if we wanted to join two words together with an
984
+ * underscore:
985
+ *
986
+ * ```typescript
987
+ * import { RRegex } from "rregex"
988
+ *
989
+ * const re = new RRegex("(?P<first>\\w+)\\s+(?P<second>\\w+)")
990
+ * const result = re.replace("deep fried", "${first}_$second")
991
+ * expect(result).toBe("deep_fried")
992
+ * ```
993
+ *
994
+ * Without the curly braces, the capture group name `first_` would be
995
+ * used, and since it doesn't exist, it would be replaced with the empty
996
+ * string.
997
+ *
998
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
999
+ * @param {string} text - The string against which to match the regular expression
1000
+ * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
1001
+ * @returns {string}
1002
+ */
1007
1003
  replace(text: string, rep: string): string;
1008
- /**
1009
- * Replaces at most `limit` non-overlapping matches in `text` with the
1010
- * replacement provided. If `limit` is 0, then all non-overlapping matches
1011
- * are replaced.
1012
- *
1013
- * See the documentation for `replace` for details on how to access
1014
- * capturing group matches in the replacement string.
1015
- *
1016
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
1017
- * @param {string} text - The string against which to match the regular expression
1018
- * @param {number} limit - Max number of replacement
1019
- * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
1020
- * @returns {string}
1021
- */
1004
+ /**
1005
+ * Replaces at most `limit` non-overlapping matches in `text` with the
1006
+ * replacement provided. If `limit` is 0, then all non-overlapping matches
1007
+ * are replaced.
1008
+ *
1009
+ * See the documentation for `replace` for details on how to access
1010
+ * capturing group matches in the replacement string.
1011
+ *
1012
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
1013
+ * @param {string} text - The string against which to match the regular expression
1014
+ * @param {number} limit - Max number of replacement
1015
+ * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
1016
+ * @returns {string}
1017
+ */
1022
1018
  replacen(text: string, limit: number, rep: string): string;
1023
- /**
1024
- * Replaces all non-overlapping matches in `text` with the replacement
1025
- * provided. This is the same as calling `replacen` with `limit` set to
1026
- * `0`.
1027
- *
1028
- * See the documentation for `replace` for details on how to access
1029
- * capturing group matches in the replacement string.
1030
- *
1031
- * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
1032
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
1033
- * @param {string} text - The string against which to match the regular expression
1034
- * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
1035
- * @returns {string}
1036
- */
1019
+ /**
1020
+ * Replaces all non-overlapping matches in `text` with the replacement
1021
+ * provided. This is the same as calling `replacen` with `limit` set to
1022
+ * `0`.
1023
+ *
1024
+ * See the documentation for `replace` for details on how to access
1025
+ * capturing group matches in the replacement string.
1026
+ *
1027
+ * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
1028
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
1029
+ * @param {string} text - The string against which to match the regular expression
1030
+ * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
1031
+ * @returns {string}
1032
+ */
1037
1033
  replaceAll(text: string, rep: string): string;
1038
- /**
1039
- * Returns an iterator of substrings of `text` delimited by a match of the
1040
- * regular expression. Namely, each element of the iterator corresponds to
1041
- * text that *isn't* matched by the regular expression.
1042
- *
1043
- * This method will *not* copy the text given.
1044
- *
1045
- * # Example
1046
- *
1047
- * To split a string delimited by arbitrary amounts of spaces or tabs:
1048
- *
1049
- * ```typescript
1050
- * import { RRegex } from "rregex"
1051
- *
1052
- * const re = new RRegex(r"[ \\t]+")
1053
- * const fields = re.split("a b \t c\td e")
1054
- * expect(fields).toEqual(["a", "b", "c", "d", "e"])
1055
- * ```
1056
- *
1057
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
1058
- * @param {string} text - The string against which to match the regular expression
1059
- * @returns {string[]}
1060
- */
1034
+ /**
1035
+ * Returns an iterator of substrings of `text` delimited by a match of the
1036
+ * regular expression. Namely, each element of the iterator corresponds to
1037
+ * text that *isn't* matched by the regular expression.
1038
+ *
1039
+ * This method will *not* copy the text given.
1040
+ *
1041
+ * # Example
1042
+ *
1043
+ * To split a string delimited by arbitrary amounts of spaces or tabs:
1044
+ *
1045
+ * ```typescript
1046
+ * import { RRegex } from "rregex"
1047
+ *
1048
+ * const re = new RRegex(r"[ \\t]+")
1049
+ * const fields = re.split("a b \t c\td e")
1050
+ * expect(fields).toEqual(["a", "b", "c", "d", "e"])
1051
+ * ```
1052
+ *
1053
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
1054
+ * @param {string} text - The string against which to match the regular expression
1055
+ * @returns {string[]}
1056
+ */
1061
1057
  split(text: string): (string)[];
1062
- /**
1063
- * Returns an iterator of at most `limit` substrings of `text` delimited
1064
- * by a match of the regular expression. (A `limit` of `0` will return no
1065
- * substrings.) Namely, each element of the iterator corresponds to text
1066
- * that *isn't* matched by the regular expression. The remainder of the
1067
- * string that is not split will be the last element in the iterator.
1068
- *
1069
- * This method will *not* copy the text given.
1070
- *
1071
- * # Example
1072
- *
1073
- * Get the first two words in some text:
1074
- *
1075
- * ```typescript
1076
- * import { RRegex } from "rregex"
1077
- *
1078
- * const re = new RRegex(r"\\W+")
1079
- * const fields = re.splitn("Hey! How are you?", 3)
1080
- * expect(fields).toEqual(["Hey", "How", "are you?"])
1081
- * ```
1082
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
1083
- * @param {string} text - The string against which to match the regular expression
1084
- * @param {number} limit - Max number result elements
1085
- * @returns {string[]}
1086
- */
1058
+ /**
1059
+ * Returns an iterator of at most `limit` substrings of `text` delimited
1060
+ * by a match of the regular expression. (A `limit` of `0` will return no
1061
+ * substrings.) Namely, each element of the iterator corresponds to text
1062
+ * that *isn't* matched by the regular expression. The remainder of the
1063
+ * string that is not split will be the last element in the iterator.
1064
+ *
1065
+ * This method will *not* copy the text given.
1066
+ *
1067
+ * # Example
1068
+ *
1069
+ * Get the first two words in some text:
1070
+ *
1071
+ * ```typescript
1072
+ * import { RRegex } from "rregex"
1073
+ *
1074
+ * const re = new RRegex(r"\\W+")
1075
+ * const fields = re.splitn("Hey! How are you?", 3)
1076
+ * expect(fields).toEqual(["Hey", "How", "are you?"])
1077
+ * ```
1078
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
1079
+ * @param {string} text - The string against which to match the regular expression
1080
+ * @param {number} limit - Max number result elements
1081
+ * @returns {string[]}
1082
+ */
1087
1083
  splitn(text: string, limit: number): (string)[];
1088
- /**
1089
- * Returns the end location of a match in the text given.
1090
- *
1091
- * This method may have the same performance characteristics as
1092
- * `isMatch`, except it provides an end location for a match. In
1093
- * particular, the location returned *may be shorter* than the proper end
1094
- * of the leftmost-first match that you would find via `Regex.find`.
1095
- *
1096
- * Note that it is not guaranteed that this routine finds the shortest or
1097
- * "earliest" possible match. Instead, the main idea of this API is that
1098
- * it returns the offset at the point at which the internal regex engine
1099
- * has determined that a match has occurred. This may vary depending on
1100
- * which internal regex engine is used, and thus, the offset itself may
1101
- * change.
1102
- *
1103
- * # Example
1104
- *
1105
- * Typically, `a+` would match the entire first sequence of `a` in some
1106
- * text, but `shortest_match` can give up as soon as it sees the first
1107
- * `a`.
1108
- *
1109
- * ```typescript
1110
- * import { RRegex } from "rregex"
1111
- *
1112
- * const text = "aaaaa"
1113
- * const = new RRegex("a+").shortest_match(text)
1114
- * expect(pos).toBe(1)
1115
- * ```
1116
- *
1117
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
1118
- * @param {string} text - The string against which to match the regular expression
1119
- * @returns {number|undefined}
1120
- */
1084
+ /**
1085
+ * Returns the end location of a match in the text given.
1086
+ *
1087
+ * This method may have the same performance characteristics as
1088
+ * `isMatch`, except it provides an end location for a match. In
1089
+ * particular, the location returned *may be shorter* than the proper end
1090
+ * of the leftmost-first match that you would find via `Regex.find`.
1091
+ *
1092
+ * Note that it is not guaranteed that this routine finds the shortest or
1093
+ * "earliest" possible match. Instead, the main idea of this API is that
1094
+ * it returns the offset at the point at which the internal regex engine
1095
+ * has determined that a match has occurred. This may vary depending on
1096
+ * which internal regex engine is used, and thus, the offset itself may
1097
+ * change.
1098
+ *
1099
+ * # Example
1100
+ *
1101
+ * Typically, `a+` would match the entire first sequence of `a` in some
1102
+ * text, but `shortest_match` can give up as soon as it sees the first
1103
+ * `a`.
1104
+ *
1105
+ * ```typescript
1106
+ * import { RRegex } from "rregex"
1107
+ *
1108
+ * const text = "aaaaa"
1109
+ * const = new RRegex("a+").shortest_match(text)
1110
+ * expect(pos).toBe(1)
1111
+ * ```
1112
+ *
1113
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
1114
+ * @param {string} text - The string against which to match the regular expression
1115
+ * @returns {number|undefined}
1116
+ */
1121
1117
  shortestMatch(text: string): number | undefined;
1122
- /**
1123
- * Returns the same as `shortest_match`, but starts the search at the
1124
- * given offset.
1125
- *
1126
- * The significance of the starting point is that it takes the surrounding
1127
- * context into consideration. For example, the `\A` anchor can only match
1128
- * when `start == 0`.
1129
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
1130
- * @param {string} text - The string against which to match the regular expression
1131
- * @param {number} start - Zero-based index at which to start matching
1132
- * @returns {number|undefined}
1133
- */
1118
+ /**
1119
+ * Returns the same as `shortest_match`, but starts the search at the
1120
+ * given offset.
1121
+ *
1122
+ * The significance of the starting point is that it takes the surrounding
1123
+ * context into consideration. For example, the `\A` anchor can only match
1124
+ * when `start == 0`.
1125
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
1126
+ * @param {string} text - The string against which to match the regular expression
1127
+ * @param {number} start - Zero-based index at which to start matching
1128
+ * @returns {number|undefined}
1129
+ */
1134
1130
  shortestMatchAt(text: string, start: number): number | undefined;
1135
- /**
1136
- * Returns the regular expression into a high level intermediate
1137
- * representation.
1138
- * @returns {any}
1139
- */
1131
+ /**
1132
+ * Returns the regular expression into a high level intermediate
1133
+ * representation.
1134
+ */
1140
1135
  syntax(): Hir;
1141
- /**
1142
- * Returns a string representing the regular expression
1143
- * @returns {string}
1144
- */
1136
+ /**
1137
+ * Returns a string representing the regular expression
1138
+ */
1145
1139
  toString(): string;
1146
1140
  }
1147
1141
  /**
1148
- * Match multiple (possibly overlapping) regular expressions in a single scan.
1149
- * A regex set corresponds to the union of two or more regular expressions.
1150
- *
1151
- * That is, a regex set will match text where at least one of its constituent
1152
- * regular expressions matches. A regex set as its formulated here provides a
1153
- * touch more power: it will also report which regular expressions in the set match.
1154
- * Indeed, this is the key difference between regex sets and a single `Regex`
1155
- * with many alternates, since only one alternate can match at a time.
1156
- *
1157
- * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
1158
- */
1142
+ * Match multiple (possibly overlapping) regular expressions in a single scan.
1143
+ * A regex set corresponds to the union of two or more regular expressions.
1144
+ *
1145
+ * That is, a regex set will match text where at least one of its constituent
1146
+ * regular expressions matches. A regex set as its formulated here provides a
1147
+ * touch more power: it will also report which regular expressions in the set match.
1148
+ * Indeed, this is the key difference between regex sets and a single `Regex`
1149
+ * with many alternates, since only one alternate can match at a time.
1150
+ *
1151
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
1152
+ */
1159
1153
  export class RRegexSet {
1160
1154
  free(): void;
1161
- /**
1162
- * Create a new regex set with the given regular expressions.
1163
- *
1164
- * This takes an of strings, if any item in the list is not a valid regular
1165
- * expressions, then an error is returned.
1166
- *
1167
- * # Example
1168
- *
1169
- * Create a new regex set from an iterator of strings:
1170
- *
1171
- * ```typescript
1172
- * import { RegexSet } from "rregex"
1173
- *
1174
- * const set = new RegexSet(["\\w+", "\\d+"])
1175
- * expect(set.is_match("foo")).toBe(true)
1176
- * ```
1177
- * @param {Array<any>} list
1178
- */
1155
+ /**
1156
+ * Create a new regex set with the given regular expressions.
1157
+ *
1158
+ * This takes an of strings, if any item in the list is not a valid regular
1159
+ * expressions, then an error is returned.
1160
+ *
1161
+ * # Example
1162
+ *
1163
+ * Create a new regex set from an iterator of strings:
1164
+ *
1165
+ * ```typescript
1166
+ * import { RegexSet } from "rregex"
1167
+ *
1168
+ * const set = new RegexSet(["\\w+", "\\d+"])
1169
+ * expect(set.is_match("foo")).toBe(true)
1170
+ * ```
1171
+ */
1179
1172
  constructor(list: Array<any>);
1180
- /**
1181
- * Returns true if and only if one of the regexes in this set matches
1182
- * the text given.
1183
- *
1184
- * This method should be preferred if you only need to test whether any
1185
- * of the regexes in the set should match, but don't care about *which*
1186
- * regexes matched. This is because the underlying matching engine will
1187
- * quit immediately after seeing the first match instead of continuing to
1188
- * find all matches.
1189
- *
1190
- * Note that as with searches using `Regex`, the expression is unanchored
1191
- * by default. That is, if the regex does not start with `^` or `\A`, or
1192
- * end with `$` or `\z`, then it is permitted to match anywhere in the
1193
- * text.
1194
- *
1195
- * # Example
1196
- *
1197
- * Tests whether a set matches some text:
1198
- *
1199
- * ```typescript
1200
- * import { RegexSet } from "rregex"
1201
- *
1202
- * const set = new RegexSet(["\\w+", "\\d+"])
1203
- * expect(set.is_match("foo")).toBe(true)
1204
- * expect(!set.is_match("☃")).toBe(false)
1205
- * ```
1206
- *
1207
- * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
1208
- * @param {string} text - The string against which to match the regular expression
1209
- * @return {boolean}
1210
- */
1173
+ /**
1174
+ * Returns true if and only if one of the regexes in this set matches
1175
+ * the text given.
1176
+ *
1177
+ * This method should be preferred if you only need to test whether any
1178
+ * of the regexes in the set should match, but don't care about *which*
1179
+ * regexes matched. This is because the underlying matching engine will
1180
+ * quit immediately after seeing the first match instead of continuing to
1181
+ * find all matches.
1182
+ *
1183
+ * Note that as with searches using `Regex`, the expression is unanchored
1184
+ * by default. That is, if the regex does not start with `^` or `\A`, or
1185
+ * end with `$` or `\z`, then it is permitted to match anywhere in the
1186
+ * text.
1187
+ *
1188
+ * # Example
1189
+ *
1190
+ * Tests whether a set matches some text:
1191
+ *
1192
+ * ```typescript
1193
+ * import { RegexSet } from "rregex"
1194
+ *
1195
+ * const set = new RegexSet(["\\w+", "\\d+"])
1196
+ * expect(set.is_match("foo")).toBe(true)
1197
+ * expect(!set.is_match("☃")).toBe(false)
1198
+ * ```
1199
+ *
1200
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
1201
+ * @param {string} text - The string against which to match the regular expression
1202
+ * @return {boolean}
1203
+ */
1211
1204
  isMatch(text: string): boolean;
1212
- /**
1213
- * Returns the set of regular expressions that match in the given text.
1214
- *
1215
- * The set returned contains the index of each regular expression that
1216
- * matches in the given text. The index is in correspondence with the
1217
- * order of regular expressions given to `RegexSet`'s constructor.
1218
- *
1219
- * The set can also be used to iterate over the matched indices.
1220
- *
1221
- * Note that as with searches using `Regex`, the expression is unanchored
1222
- * by default. That is, if the regex does not start with `^` or `\A`, or
1223
- * end with `$` or `\z`, then it is permitted to match anywhere in the
1224
- * text.
1225
- *
1226
- * # Example
1227
- *
1228
- * Tests which regular expressions match the given text:
1229
- *
1230
- * ```typescript
1231
- * import { RegexSet } from "rregex"
1232
- *
1233
- * const set = new RegexSet([
1234
- * "\\w+",
1235
- * "\\d+",
1236
- * "\\pL+",
1237
- * "foo",
1238
- * "bar",
1239
- * "barfoo",
1240
- * "foobar",
1241
- * ])
1242
- * const matches = set.matches("foobar")
1243
- * expect(matches).toBe([0, 2, 3, 4, 6])
1244
- * ```
1245
- *
1246
- * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.matches
1247
- * @param {string} text - The string against which to match the regular expression
1248
- * @return {number[]}
1249
- */
1205
+ /**
1206
+ * Returns the set of regular expressions that match in the given text.
1207
+ *
1208
+ * The set returned contains the index of each regular expression that
1209
+ * matches in the given text. The index is in correspondence with the
1210
+ * order of regular expressions given to `RegexSet`'s constructor.
1211
+ *
1212
+ * The set can also be used to iterate over the matched indices.
1213
+ *
1214
+ * Note that as with searches using `Regex`, the expression is unanchored
1215
+ * by default. That is, if the regex does not start with `^` or `\A`, or
1216
+ * end with `$` or `\z`, then it is permitted to match anywhere in the
1217
+ * text.
1218
+ *
1219
+ * # Example
1220
+ *
1221
+ * Tests which regular expressions match the given text:
1222
+ *
1223
+ * ```typescript
1224
+ * import { RegexSet } from "rregex"
1225
+ *
1226
+ * const set = new RegexSet([
1227
+ * "\\w+",
1228
+ * "\\d+",
1229
+ * "\\pL+",
1230
+ * "foo",
1231
+ * "bar",
1232
+ * "barfoo",
1233
+ * "foobar",
1234
+ * ])
1235
+ * const matches = set.matches("foobar")
1236
+ * expect(matches).toBe([0, 2, 3, 4, 6])
1237
+ * ```
1238
+ *
1239
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.matches
1240
+ * @param {string} text - The string against which to match the regular expression
1241
+ * @return {number[]}
1242
+ */
1250
1243
  matches(text: string): number[];
1251
1244
  }
1252
1245
 
@@ -1254,36 +1247,40 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
1254
1247
 
1255
1248
  export interface InitOutput {
1256
1249
  readonly memory: WebAssembly.Memory;
1257
- readonly __wbg_rregex_free: (a: number) => void;
1258
- readonly rregex_new: (a: number, b: number, c: number) => void;
1250
+ readonly __wbg_rregex_free: (a: number, b: number) => void;
1251
+ readonly rregex_new: (a: number, b: number) => [number, number, number];
1259
1252
  readonly rregex_isMatch: (a: number, b: number, c: number) => number;
1260
1253
  readonly rregex_isMatchAt: (a: number, b: number, c: number, d: number) => number;
1261
- readonly rregex_find: (a: number, b: number, c: number, d: number) => void;
1262
- readonly rregex_findAt: (a: number, b: number, c: number, d: number, e: number) => void;
1263
- readonly rregex_findAll: (a: number, b: number, c: number, d: number) => void;
1264
- readonly rregex_captureNames: (a: number, b: number) => void;
1265
- readonly rregex_captures: (a: number, b: number, c: number, d: number) => void;
1266
- readonly rregex_capturesAll: (a: number, b: number, c: number, d: number) => void;
1254
+ readonly rregex_find: (a: number, b: number, c: number) => [number, number, number];
1255
+ readonly rregex_findAt: (a: number, b: number, c: number, d: number) => [number, number, number];
1256
+ readonly rregex_findAll: (a: number, b: number, c: number) => [number, number, number];
1257
+ readonly rregex_captureNames: (a: number) => [number, number];
1258
+ readonly rregex_captures: (a: number, b: number, c: number) => [number, number, number];
1259
+ readonly rregex_capturesAll: (a: number, b: number, c: number) => [number, number, number];
1267
1260
  readonly rregex_capturesLength: (a: number) => number;
1268
- readonly rregex_replace: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1269
- readonly rregex_replacen: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1270
- readonly rregex_replaceAll: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1271
- readonly rregex_split: (a: number, b: number, c: number, d: number) => void;
1272
- readonly rregex_splitn: (a: number, b: number, c: number, d: number, e: number) => void;
1273
- readonly rregex_shortestMatch: (a: number, b: number, c: number, d: number) => void;
1274
- readonly rregex_shortestMatchAt: (a: number, b: number, c: number, d: number, e: number) => void;
1275
- readonly rregex_syntax: (a: number, b: number) => void;
1276
- readonly rregex_toString: (a: number, b: number) => void;
1277
- readonly __wbg_rregexset_free: (a: number) => void;
1278
- readonly rregexset_new: (a: number, b: number) => void;
1261
+ readonly rregex_replace: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1262
+ readonly rregex_replacen: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1263
+ readonly rregex_replaceAll: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1264
+ readonly rregex_split: (a: number, b: number, c: number) => [number, number];
1265
+ readonly rregex_splitn: (a: number, b: number, c: number, d: number) => [number, number];
1266
+ readonly rregex_shortestMatch: (a: number, b: number, c: number) => number;
1267
+ readonly rregex_shortestMatchAt: (a: number, b: number, c: number, d: number) => number;
1268
+ readonly rregex_syntax: (a: number) => [number, number, number];
1269
+ readonly rregex_toString: (a: number) => [number, number];
1270
+ readonly __wbg_rregexset_free: (a: number, b: number) => void;
1271
+ readonly rregexset_new: (a: any) => [number, number, number];
1279
1272
  readonly rregexset_isMatch: (a: number, b: number, c: number) => number;
1280
- readonly rregexset_matches: (a: number, b: number, c: number, d: number) => void;
1281
- readonly escape: (a: number, b: number, c: number) => void;
1273
+ readonly rregexset_matches: (a: number, b: number, c: number) => [number, number];
1274
+ readonly escape: (a: number, b: number) => [number, number];
1275
+ readonly __wbindgen_exn_store: (a: number) => void;
1276
+ readonly __externref_table_alloc: () => number;
1277
+ readonly __wbindgen_export_2: WebAssembly.Table;
1282
1278
  readonly __wbindgen_malloc: (a: number, b: number) => number;
1283
1279
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1284
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
1280
+ readonly __externref_table_dealloc: (a: number) => void;
1281
+ readonly __externref_drop_slice: (a: number, b: number) => void;
1285
1282
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
1286
- readonly __wbindgen_exn_store: (a: number) => void;
1283
+ readonly __wbindgen_start: () => void;
1287
1284
  }
1288
1285
 
1289
1286
  export type SyncInitInput = BufferSource | WebAssembly.Module;
@@ -1291,21 +1288,21 @@ export type SyncInitInput = BufferSource | WebAssembly.Module;
1291
1288
  * Instantiates the given `module`, which can either be bytes or
1292
1289
  * a precompiled `WebAssembly.Module`.
1293
1290
  *
1294
- * @param {SyncInitInput} module
1291
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
1295
1292
  *
1296
1293
  * @returns {InitOutput}
1297
1294
  */
1298
- export function initSync(module: SyncInitInput): InitOutput;
1295
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
1299
1296
 
1300
1297
  /**
1301
1298
  * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
1302
1299
  * for everything else, calls `WebAssembly.instantiate` directly.
1303
1300
  *
1304
- * @param {InitInput | Promise<InitInput>} module_or_path
1301
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
1305
1302
  *
1306
1303
  * @returns {Promise<InitOutput>}
1307
1304
  */
1308
- export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
1305
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
1309
1306
 
1310
1307
  /** Build metadata */
1311
1308
  export const metadata: {
@@ -1316,6 +1313,6 @@ export const metadata: {
1316
1313
  ],
1317
1314
  "homepage": "http://rregex.dev",
1318
1315
  "repository": "https://github.com/2fd/rregex",
1319
- "regex": "1.10.4",
1320
- "regex-syntax": "0.8.3"
1316
+ "regex": "1.11.1",
1317
+ "regex-syntax": "0.8.5"
1321
1318
  }