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