Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/regex/testdata/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 5 kB image not shown  

Quelle  overlapping.toml   Sprache: unbekannt

 
Spracherkennung für: .toml vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

# NOTE: We define a number of tests where the *match* kind is 'leftmost-first'
# but the *search* kind is 'overlapping'. This is a somewhat nonsensical
# combination and can produce odd results. Nevertheless, those results should
# be consistent so we test them here. (At the time of writing this note, I
# hadn't yet decided whether to make 'leftmost-first' with 'overlapping' result
# in unspecified behavior.)

# This demonstrates how a full overlapping search is obvious quadratic. This
# regex reports a match for every substring in the haystack.
[[test]]
name = "ungreedy-dotstar-matches-everything-100"
regex = [".*?"]
haystack = "zzz"
matches = [
  { id = 0, span = [00] },
  { id = 0, span = [11] },
  { id = 0, span = [01] },
  { id = 0, span = [22] },
  { id = 0, span = [12] },
  { id = 0, span = [02] },
  { id = 0, span = [33] },
  { id = 0, span = [23] },
  { id = 0, span = [13] },
  { id = 0, span = [03] },
]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "greedy-dotstar-matches-everything-100"
regex = [".*"]
haystack = "zzz"
matches = [
  { id = 0, span = [00] },
  { id = 0, span = [11] },
  { id = 0, span = [01] },
  { id = 0, span = [22] },
  { id = 0, span = [12] },
  { id = 0, span = [02] },
  { id = 0, span = [33] },
  { id = 0, span = [23] },
  { id = 0, span = [13] },
  { id = 0, span = [03] },
]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "repetition-plus-leftmost-first-100"
regex = 'a+'
haystack = "aaa"
matches = [[01], [12], [02], [23], [13], [03]]
match-kind = "leftmost-first"
search-kind = "overlapping"

[[test]]
name = "repetition-plus-leftmost-first-110"
regex = '☃+'
haystack = "☃☃☃"
matches = [[03], [36], [06], [69], [39], [09]]
match-kind = "leftmost-first"
search-kind = "overlapping"

[[test]]
name = "repetition-plus-all-100"
regex = 'a+'
haystack = "aaa"
matches = [[01], [12], [02], [23], [13], [03]]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "repetition-plus-all-110"
regex = '☃+'
haystack = "☃☃☃"
matches = [[03], [36], [06], [69], [39], [09]]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "repetition-plus-leftmost-first-200"
regex = '(abc)+'
haystack = "zzabcabczzabc"
matches = [
  [[25], [25]],
  [[58], [58]],
  [[28], [58]],
]
match-kind = "leftmost-first"
search-kind = "overlapping"

[[test]]
name = "repetition-plus-all-200"
regex = '(abc)+'
haystack = "zzabcabczzabc"
matches = [
  [[25], [25]],
  [[58], [58]],
  [[28], [58]],
  [[1013], [1013]],
]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "repetition-star-leftmost-first-100"
regex = 'a*'
haystack = "aaa"
matches = [
  [00],
  [11],
  [01],
  [22],
  [12],
  [02],
  [33],
  [23],
  [13],
  [03],
]
match-kind = "leftmost-first"
search-kind = "overlapping"

[[test]]
name = "repetition-star-all-100"
regex = 'a*'
haystack = "aaa"
matches = [
  [00],
  [11],
  [01],
  [22],
  [12],
  [02],
  [33],
  [23],
  [13],
  [03],
]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "repetition-star-leftmost-first-200"
regex = '(abc)*'
haystack = "zzabcabczzabc"
matches = [
  [[00], []],
]
match-kind = "leftmost-first"
search-kind = "overlapping"

[[test]]
name = "repetition-star-all-200"
regex = '(abc)*'
haystack = "zzabcabczzabc"
matches = [
  [[00], []],
  [[11], []],
  [[22], []],
  [[33], []],
  [[44], []],
  [[55], []],
  [[25], [25]],
  [[66], []],
  [[77], []],
  [[88], []],
  [[58], [58]],
  [[28], [58]],
  [[99], []],
  [[1010], []],
  [[1111], []],
  [[1212], []],
  [[1313], []],
  [[1013], [1013]],
]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "start-end-rep-leftmost-first"
regex = '(^$)*'
haystack = "abc"
matches = [
  [[00], []],
]
match-kind = "leftmost-first"
search-kind = "overlapping"

[[test]]
name = "start-end-rep-all"
regex = '(^$)*'
haystack = "abc"
matches = [
  [[00], []],
  [[11], []],
  [[22], []],
  [[33], []],
]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "alt-leftmost-first-100"
regex = 'abc|a'
haystack = "zzabcazzaabc"
matches = [[23], [25]]
match-kind = "leftmost-first"
search-kind = "overlapping"

[[test]]
name = "alt-all-100"
regex = 'abc|a'
haystack = "zzabcazzaabc"
matches = [[23], [25], [56], [89], [910], [912]]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "empty-000"
regex = ""
haystack = "abc"
matches = [[00], [11], [22], [33]]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "empty-alt-000"
regex = "|b"
haystack = "abc"
matches = [[00], [11], [22], [12], [33]]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "empty-alt-010"
regex = "b|"
haystack = "abc"
matches = [[00], [11], [22], [12], [33]]
match-kind = "all"
search-kind = "overlapping"

[[test]]
# See: https://github.com/rust-lang/regex/issues/484
name = "iter1-bytes"
regex = ''
haystack = "☃"
matches = [[00], [11], [22], [33]]
utf8 = false
match-kind = "all"
search-kind = "overlapping"

[[test]]
# See: https://github.com/rust-lang/regex/issues/484
name = "iter1-utf8"
regex = ''
haystack = "☃"
matches = [[00], [33]]
match-kind = "all"
search-kind = "overlapping"

[[test]]
name = "iter1-incomplete-utf8"
regex = ''
haystack = '\xE2\x98'  # incomplete snowman
matches = [[00], [11], [22]]
match-kind = "all"
search-kind = "overlapping"
unescape = true
utf8 = false

[[test]]
name = "scratch"
regex = ['sam', 'samwise']
haystack = "samwise"
matches = [
  { id = 0, span = [03] },
]
match-kind = "leftmost-first"
search-kind = "overlapping"

[Dauer der Verarbeitung: 0.13 Sekunden, vorverarbeitet 2026-06-07]