description = '''
word boundary tests, cross-validated against the regex crate.
'''
[[test]]
name = "basic_boundary"
pattern = '(and|AND)\b(.*)'
input = "xxxxxANDyyyyy"
vs_regex = true
[[test]]
name = "basic_boundary"
pattern = '(and|AND)\b(.*)'
input = "xxxxxANDyyyyy"
vs_regex = true
[[test]]
name = "wb_bare_11"
pattern = '\b11\b'
input = "11"
vs_regex = true
[[test]]
name = "wb_leading_space"
pattern = '\b11\b'
input = " 11"
vs_regex = true
[[test]]
name = "wb_trailing_space"
pattern = '\b11\b'
input = "11 "
vs_regex = true
[[test]]
name = "wb_both_spaces"
pattern = '\b11\b'
input = " 11 "
vs_regex = true
[[test]]
name = "wb_long_word_12plus"
pattern = '\b[a-z]{12,}\b'
input = "hello extraordinary world"
vs_regex = true
[[test]]
name = "wb_long_word_no_match"
pattern = '\b[a-z]{12,}\b'
input = "hello world foo"
vs_regex = true
[[test]]
name = "wb_long_word_multiple"
pattern = '\b[a-z]{12,}\b'
input = "understanding communication"
vs_regex = true
[[test]]
name = "wb_long_word_mixed_case"
pattern = '\b[a-z]{12,}\b'
input = "THE understanding OF communication HERE"
vs_regex = true
[[test]]
name = "wb_long_word_at_start"
pattern = '\b[a-z]{12,}\b'
input = "extraordinary!"
vs_regex = true
[[test]]
name = "wb_long_word_at_end"
pattern = '\b[a-z]{12,}\b'
input = "!extraordinary"
vs_regex = true
[[test]]
name = "wb_exact_13"
pattern = '\b[a-z]{13}\b'
input = "hello world extraordinary"
vs_regex = true
[[test]]
name = "wb_exact_12_no_match"
pattern = '\b[a-z]{12}\b'
input = "hello world extraordinary"
vs_regex = true
[[test]]
name = "wb_word_plus"
pattern = '\b\w+\b'
input = "hello world"
vs_regex = true
[[test]]
name = "wb_digits"
pattern = '\b\d+\b'
input = "foo 123 bar"
vs_regex = true
[[test]]
name = "wb_lowercase_words"
pattern = '\b[a-z]+\b'
input = "hello WORLD foo"
vs_regex = true
[[test]]
name = "wb_partial_leading"
pattern = '\b11'
input = " 11"
vs_regex = true
[[test]]
name = "wb_partial_trailing"
pattern = '11\b'
input = "11 "
vs_regex = true
[[test]]
name = "wb_partial_trailing_bare"
pattern = '11\b'
input = "11"
vs_regex = true
[[test]]
name = "wb_contains_a"
pattern = '\b\w*a\w*\b'
input = "ffaff"
vs_regex = true
[[test]]
name = "wb_trailing_a"
pattern = 'a\b'
input = "a "
vs_regex = true
[[test]]
name = "wb_dash_boundary"
pattern = '\b-'
input = "1-2"
vs_regex = true
[[test]]
name = "wb_before_dash"
pattern = '1\b-'
input = "1-2"
vs_regex = true
[[test]]
name = "wb_across_dash"
pattern = '1\b-2'
input = "1-2"
vs_regex = true
[[test]]
name = "wb_no_match_embedded"
pattern = '\b11\b'
input = "a11b"
vs_regex = true
[[test]]
name = "wb_adjacent_words"
pattern = '\b[a-z]+\b'
input = "cat dog bird"
vs_regex = true
[[test]]
name = "wb_bounded_rep_at_boundary"
pattern = '\b[a-z]{3,5}\b'
input = "cat extraordinary dog bird"
vs_regex = true
[[test]]
name = "wb_whitespace_neighbor"
pattern = '\s\b[a-z]+\b\s'
input = " cat "
vs_regex = true
[[test]]
name = "wb_after_whitespace_class"
pattern = '[ \t]\b\w+'
input = " hello\tworld"
vs_regex = true
[[test]]
name = "wb_alpha_class_union"
pattern = '\b[a-zA-Z]+\b'
input = "Hello WORLD foo 123"
vs_regex = true
[[test]]
name = "wb_alnum_class"
pattern = '\b[a-zA-Z0-9]+\b'
input = "foo123 !bar! 42"
vs_regex = true
[[test]]
name = "wb_the_basic"
pattern = '\bthe\b'
input = "foo the bar"
vs_regex = true
[[test]]
name = "wb_the_multiple"
pattern = '\bthe\b'
input = "the cat and the dog and the fish"
vs_regex = true
[[test]]
name = "wb_the_no_match"
pattern = '\bthe\b'
input = "other breathe"
vs_regex = true
[[test]]
name = "wb_the_start_end"
pattern = '\bthe\b'
input = "the"
vs_regex = true
[[test]]
name = "wb_the_adjacent"
pattern = '\bthe\b'
input = "!the! .the. the"
vs_regex = true
[[test]]
name = "word_border_star"
pattern = '\bTrue\b *'
input = "True"
matches = [[0, 4]]
[[test]]
name = "word_border_req_word_trailing_no_match"
pattern = '!!\b'
input = "!!"
matches = []
[[test]]
name = "word_border_req_word_leading_no_match"
pattern = '\b!!'
input = "!!"
matches = []
[[test]]
name = "word_border_req_word_leading_match"
pattern = '\b!!'
input = "a!!"
matches = [[1, 3]]
[[test]]
name = "word_border_req_word_trailing_match"
pattern = '!!\b'
input = "!!a"
matches = [[0, 2]]
[[test]]
name = "word_boundary_ip_trailing_b_not_boundary"
pattern = '2(\.([0-1]?[0-9]{1,2}|2[0-4][0-9])){3}\b'
input = "2.3.3.3a!"
matches = []
[[test]]
name = "unanchored_fwd_ascii_word"
pattern = '\w\w-\w\w'
input = "xxxxx00-00yyyyy"
matches = [[5, 10]]
[[test]]
name = "wb_nonword_class_foo_bang"
pattern = '\b\W'
input = "foo /*!"
matches = [[3, 4]]
[[test]]
name = "not_wb_thousands_sep_7digits"
pattern = '\B(?!\.\d*)(?=(\d{3})+(?!\d))'
input = "1234567"
matches = [[1, 1], [4, 4]]
[[test]]
name = "not_wb_thousands_sep_decimal"
pattern = '\B(?!\.\d*)(?=(\d{3})+(?!\d))'
input = "1234.5"
matches = [[1, 1]]
[[test]]
name = "not_wb_before_upper_run"
pattern = '\B(?=[A-Z]{2,})'
input = "fooBAR baz QUX"
matches = [[3, 3], [4, 4], [12, 12]]
[[test]]
name = "wb_after_mixed_class_category_no_match"
pattern = 'cat\b\w*'
input = "category"
matches = []
[[test]]
name = "wb_script_tag_no_match"
pattern = '<script\b[^<]*'
input = "<scripts!</script>)<"
matches = []
[[test]]
name = "wb_cat_word_boundary_no_match"
pattern = 'cat\b'
input = "category"
matches = []
[[test]]
name = "wb_cat_word_boundary_match"
pattern = 'cat\b'
input = "cat dog"
matches = [[0, 3]]
[[test]]
name = "wb_ci_cat_word_no_match"
pattern = '(?i)cat\b\w*'
input = "category"
matches = []
[[test]]
name = "wb_ci_script_tag_no_match"
pattern = '(?i)<script\b[^<]*'
input = "<scripts!</script>)<"
matches = []
[[test]]
name = "wb_leading_optional_nonword_unsupported"
pattern = '\b(`?\w+)\.(\w+)\b'
input = "a.b"
expect_error = true
[[test]]
name = "wb_trailing_optional_nonword_supported"
pattern = '\b(\w+`?)\.(\w+)\b'
input = "a.b foo.bar"
matches = [[0, 3], [4, 11]]
[[test]]
name = "wb_leading_optional_apostrophe_unsupported"
pattern = "\\b'?\\w+"
input = "foo"
expect_error = true
[[test]]
name = "wb_leading_optional_apostrophe_both_unsupported"
pattern = "\\b'?\\w+\\b"
input = "foo"
expect_error = true
[[test]]
name = "wb_nonboundary_optional_apostrophe_unsupported"
pattern = "\\B'?\\w+"
input = "foo"
expect_error = true
[[test]]
name = "wb_leading_optional_nonword_class_unsupported"
pattern = '\b\W?\w+\b'
input = "foo"
expect_error = true
[[test]]
name = "wb_leading_union_optional_apostrophe_unsupported"
pattern = "\\b(a|'b)\\b"
input = "ab"
expect_error = true
[[test]]
name = "wb_leading_star_apostrophe_unsupported"
pattern = "\\b'*x\\b"
input = "x"
expect_error = true
[[test]]
name = "wb_leading_optional_word_head_supported_xy"
pattern = '\bx?y\b'
input = "xy"
matches = [[0, 2]]
ascii = true
[[test]]
name = "wb_leading_optional_word_head_supported_y"
pattern = '\bx?y\b'
input = "y"
matches = [[0, 1]]
ascii = true
[[test]]
name = "wb_leading_optional_word_head_no_match_apostrophe"
pattern = '\bx?y\b'
input = "a'b"
matches = []
ascii = true
[[test]]
name = "wb_leading_optional_word_head_no_match_x"
pattern = '\bx?y\b'
input = "''x"
matches = []
ascii = true
[[test]]
name = "email_boundary_inner_literal"
pattern = '\b([a-zA-Z0-9])([a-zA-Z0-9\.\_-]+)@([a-zA-Z0-9\.-]+)\.([a-zA-Z]{2,})\b'
input = "contact a@b.com or x.y_z@sub.example.org, not @bad or foo@bar"
matches = [[19, 40]]
[[test]]
name = "word_boundary_after_grouped_trailing_lookahead_capturing"
pattern = '(a(?= ))\b'
input = "a b"
matches = [[0, 1]]
[[test]]
name = "word_boundary_after_grouped_trailing_lookahead_noncapturing"
pattern = '(?:a(?= ))\b'
input = "a b"
matches = [[0, 1]]
[[test]]
name = "word_boundary_after_trailing_lookahead_ungrouped"
pattern = 'a(?= )\b'
input = "a b"
matches = [[0, 1]]
[[test]]
name = "non_word_boundary_after_newline"
pattern = '\B'
input = "\ncb"
matches = [[0, 0], [2, 2]]
[[test]]
name = "word_boundary_broadened_begin_anchor"
pattern = '\b11\b'
input = "11 "
matches = [[0, 2]]
[[test]]
name = "word_boundary_after_newline"
pattern = 'a\b'
input = "a\nb"
matches = [[0, 1]]
ascii = true
[[test]]
name = "word_boundary_after_newline_anchored"
pattern = 'a\b'
input = "a\nb"
matches = [[0, 1]]
ascii = true
anchored = true
[[test]]
name = "grouped_optional_lookahead_before_non_word_boundary"
pattern = '((?=x?))\B'
input = "ba c"
matches = [[1, 1]]
ascii = true