// Copyright 2014 The Rust Project Developers. // Copyright 2015-2016 Joe Neeman. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // DO NOT EDIT. Automatically generated by 'scripts/regex-match-tests.py' // on 2015-02-28 11:00:00.161706. extern crate regex_dfa; use regex_dfa::Regex; macro_rules! mat( ($name:ident, $re:expr, $text:expr, $($loc:tt)+) => ( #[test] fn $name() { let text = $text; let expected: Vec> = vec!($($loc)+); let r = Regex::new($re).unwrap(); let pos = r.find(text); // We don't support capture groups, so just check the whole match. if expected[0] != pos { panic!("For RE '{}' against '{:?}', expected '{:?}' but got '{:?}'", $re, text, expected, pos); } } ); ); macro_rules! no_mat( ($name:ident, $re:expr, $text:expr) => ( #[test] fn $name() { let text = $text; let r = Regex::new($re).unwrap(); println!("{:?}", r); let result = r.find(text); if result.is_some() { panic!("For RE '{}' against '{:?}', expected None but got '{:?}'", $re, text, result); } } ); ); // Tests from basic.dat mat!(match_basic_3, r"abracadabra$", r"abracadabracadabra", Some((7, 18))); mat!(match_basic_4, r"a...b", r"abababbb", Some((2, 7))); mat!(match_basic_5, r"XXXXXX", r"..XXXXXX", Some((2, 8))); mat!(match_basic_6, r"\)", r"()", Some((1, 2))); mat!(match_basic_7, r"a]", r"a]a", Some((0, 2))); mat!(match_basic_9, r"\}", r"}", Some((0, 1))); mat!(match_basic_10, r"\]", r"]", Some((0, 1))); mat!(match_basic_12, r"]", r"]", Some((0, 1))); mat!(match_basic_15, r"^a", r"ax", Some((0, 1))); mat!(match_basic_16, r"\^a", r"a^a", Some((1, 3))); mat!(match_basic_17, r"a\^", r"a^", Some((0, 2))); mat!(match_basic_18, r"a$", r"aa", Some((1, 2))); mat!(match_basic_19, r"a\$", r"a$", Some((0, 2))); mat!(match_basic_20, r"^$", r"", Some((0, 0))); mat!(match_basic_21, r"$^", r"", Some((0, 0))); mat!(match_basic_22, r"a($)", r"aa", Some((1, 2)), Some((2, 2))); mat!(match_basic_23, r"a*(^a)", r"aa", Some((0, 1)), Some((0, 1))); mat!(match_basic_24, r"(..)*(...)*", r"a", Some((0, 0))); mat!(match_basic_25, r"(..)*(...)*", r"abcd", Some((0, 4)), Some((2, 4))); mat!(match_basic_26, r"(ab|a)(bc|c)", r"abc", Some((0, 3)), Some((0, 2)), Some((2, 3))); mat!(match_basic_27, r"(ab)c|abc", r"abc", Some((0, 3)), Some((0, 2))); mat!(match_basic_28, r"a{0}b", r"ab", Some((1, 2))); mat!(match_basic_29, r"(a*)(b?)(b+)b{3}", r"aaabbbbbbb", Some((0, 10)), Some((0, 3)), Some((3, 4)), Some((4, 7))); mat!(match_basic_30, r"(a*)(b{0,1})(b{1,})b{3}", r"aaabbbbbbb", Some((0, 10)), Some((0, 3)), Some((3, 4)), Some((4, 7))); mat!(match_basic_32, r"((a|a)|a)", r"a", Some((0, 1)), Some((0, 1)), Some((0, 1))); mat!(match_basic_33, r"(a*)(a|aa)", r"aaaa", Some((0, 4)), Some((0, 3)), Some((3, 4))); mat!(match_basic_34, r"a*(a.|aa)", r"aaaa", Some((0, 4)), Some((2, 4))); mat!(match_basic_35, r"a(b)|c(d)|a(e)f", r"aef", Some((0, 3)), None, None, Some((1, 2))); mat!(match_basic_36, r"(a|b)?.*", r"b", Some((0, 1)), Some((0, 1))); mat!(match_basic_37, r"(a|b)c|a(b|c)", r"ac", Some((0, 2)), Some((0, 1))); mat!(match_basic_38, r"(a|b)c|a(b|c)", r"ab", Some((0, 2)), None, Some((1, 2))); mat!(match_basic_39, r"(a|b)*c|(a|ab)*c", r"abc", Some((0, 3)), Some((1, 2))); mat!(match_basic_40, r"(a|b)*c|(a|ab)*c", r"xc", Some((1, 2))); mat!(match_basic_41, r"(.a|.b).*|.*(.a|.b)", r"xa", Some((0, 2)), Some((0, 2))); mat!(match_basic_42, r"a?(ab|ba)ab", r"abab", Some((0, 4)), Some((0, 2))); mat!(match_basic_43, r"a?(ac{0}b|ba)ab", r"abab", Some((0, 4)), Some((0, 2))); mat!(match_basic_44, r"ab|abab", r"abbabab", Some((0, 2))); mat!(match_basic_45, r"aba|bab|bba", r"baaabbbaba", Some((5, 8))); mat!(match_basic_46, r"aba|bab", r"baaabbbaba", Some((6, 9))); mat!(match_basic_47, r"(aa|aaa)*|(a|aaaaa)", r"aa", Some((0, 2)), Some((0, 2))); mat!(match_basic_48, r"(a.|.a.)*|(a|.a...)", r"aa", Some((0, 2)), Some((0, 2))); mat!(match_basic_49, r"ab|a", r"xabc", Some((1, 3))); mat!(match_basic_50, r"ab|a", r"xxabc", Some((2, 4))); mat!(match_basic_51, r"(?i)(Ab|cD)*", r"aBcD", Some((0, 4)), Some((2, 4))); mat!(match_basic_52, r"[^-]", r"--a", Some((2, 3))); mat!(match_basic_53, r"[a-]*", r"--a", Some((0, 3))); mat!(match_basic_54, r"[a-m-]*", r"--amoma--", Some((0, 4))); mat!(match_basic_55, r":::1:::0:|:::1:1:0:", r":::0:::1:::1:::0:", Some((8, 17))); mat!(match_basic_56, r":::1:::0:|:::1:1:1:", r":::0:::1:::1:::0:", Some((8, 17))); mat!(match_basic_57, r"[[:upper:]]", r"A", Some((0, 1))); mat!(match_basic_58, r"[[:lower:]]+", r"`az{", Some((1, 3))); mat!(match_basic_59, r"[[:upper:]]+", r"@AZ[", Some((1, 3))); mat!(match_basic_65, r" ", r" ", Some((0, 1))); mat!(match_basic_66, r" ", r" ", Some((0, 1))); mat!(match_basic_67, r"[^a]", r" ", Some((0, 1))); mat!(match_basic_68, r" a", r" a", Some((0, 2))); mat!(match_basic_69, r"(a)(b)(c)", r"abc", Some((0, 3)), Some((0, 1)), Some((1, 2)), Some((2, 3))); mat!(match_basic_70, r"xxx", r"xxx", Some((0, 3))); mat!(match_basic_71, r"(^|[ (,;])((([Ff]eb[^ ]* *|0*2/|\* */?)0*[6-7]))([^0-9]|$)", r"feb 6,", Some((0, 6))); mat!(match_basic_72, r"(^|[ (,;])((([Ff]eb[^ ]* *|0*2/|\* */?)0*[6-7]))([^0-9]|$)", r"2/7", Some((0, 3))); mat!(match_basic_73, r"(^|[ (,;])((([Ff]eb[^ ]* *|0*2/|\* */?)0*[6-7]))([^0-9]|$)", r"feb 1,Feb 6", Some((5, 11))); mat!(match_basic_74, r"((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))", r"x", Some((0, 1)), Some((0, 1)), Some((0, 1))); mat!(match_basic_75, r"((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))*", r"xx", Some((0, 2)), Some((1, 2)), Some((1, 2))); mat!(match_basic_76, r"a?(ab|ba)*", r"ababababababababababababababababababababababababababababababababababababababababa", Some((0, 81)), Some((79, 81))); mat!(match_basic_77, r"abaa|abbaa|abbbaa|abbbbaa", r"ababbabbbabbbabbbbabbbbaa", Some((18, 25))); mat!(match_basic_78, r"abaa|abbaa|abbbaa|abbbbaa", r"ababbabbbabbbabbbbabaa", Some((18, 22))); mat!(match_basic_79, r"aaac|aabc|abac|abbc|baac|babc|bbac|bbbc", r"baaabbbabac", Some((7, 11))); mat!(match_basic_80, r".*", r"", Some((0, 2))); mat!(match_basic_81, r"aaaa|bbbb|cccc|ddddd|eeeeee|fffffff|gggg|hhhh|iiiii|jjjjj|kkkkk|llll", r"XaaaXbbbXcccXdddXeeeXfffXgggXhhhXiiiXjjjXkkkXlllXcbaXaaaa", Some((53, 57))); mat!(match_basic_83, r"a*a*a*a*a*b", r"aaaaaaaaab", Some((0, 10))); mat!(match_basic_84, r"^", r"", Some((0, 0))); mat!(match_basic_85, r"$", r"", Some((0, 0))); mat!(match_basic_86, r"^$", r"", Some((0, 0))); mat!(match_basic_87, r"^a$", r"a", Some((0, 1))); mat!(match_basic_88, r"abc", r"abc", Some((0, 3))); mat!(match_basic_89, r"abc", r"xabcy", Some((1, 4))); mat!(match_basic_90, r"abc", r"ababc", Some((2, 5))); mat!(match_basic_91, r"ab*c", r"abc", Some((0, 3))); mat!(match_basic_92, r"ab*bc", r"abc", Some((0, 3))); mat!(match_basic_93, r"ab*bc", r"abbc", Some((0, 4))); mat!(match_basic_94, r"ab*bc", r"abbbbc", Some((0, 6))); mat!(match_basic_95, r"ab+bc", r"abbc", Some((0, 4))); mat!(match_basic_96, r"ab+bc", r"abbbbc", Some((0, 6))); mat!(match_basic_97, r"ab?bc", r"abbc", Some((0, 4))); mat!(match_basic_98, r"ab?bc", r"abc", Some((0, 3))); mat!(match_basic_99, r"ab?c", r"abc", Some((0, 3))); mat!(match_basic_100, r"^abc$", r"abc", Some((0, 3))); mat!(match_basic_101, r"^abc", r"abcc", Some((0, 3))); mat!(match_basic_102, r"abc$", r"aabc", Some((1, 4))); mat!(match_basic_103, r"^", r"abc", Some((0, 0))); mat!(match_basic_104, r"$", r"abc", Some((3, 3))); mat!(match_basic_105, r"a.c", r"abc", Some((0, 3))); mat!(match_basic_106, r"a.c", r"axc", Some((0, 3))); mat!(match_basic_107, r"a.*c", r"axyzc", Some((0, 5))); mat!(match_basic_108, r"a[bc]d", r"abd", Some((0, 3))); mat!(match_basic_109, r"a[b-d]e", r"ace", Some((0, 3))); mat!(match_basic_110, r"a[b-d]", r"aac", Some((1, 3))); mat!(match_basic_111, r"a[-b]", r"a-", Some((0, 2))); mat!(match_basic_112, r"a[b-]", r"a-", Some((0, 2))); mat!(match_basic_113, r"a]", r"a]", Some((0, 2))); mat!(match_basic_114, r"a[]]b", r"a]b", Some((0, 3))); mat!(match_basic_115, r"a[^bc]d", r"aed", Some((0, 3))); mat!(match_basic_116, r"a[^-b]c", r"adc", Some((0, 3))); mat!(match_basic_117, r"a[^]b]c", r"adc", Some((0, 3))); mat!(match_basic_118, r"ab|cd", r"abc", Some((0, 2))); mat!(match_basic_119, r"ab|cd", r"abcd", Some((0, 2))); mat!(match_basic_120, r"a\(b", r"a(b", Some((0, 3))); mat!(match_basic_121, r"a\(*b", r"ab", Some((0, 2))); mat!(match_basic_122, r"a\(*b", r"a((b", Some((0, 4))); mat!(match_basic_123, r"((a))", r"abc", Some((0, 1)), Some((0, 1)), Some((0, 1))); mat!(match_basic_124, r"(a)b(c)", r"abc", Some((0, 3)), Some((0, 1)), Some((2, 3))); mat!(match_basic_125, r"a+b+c", r"aabbabc", Some((4, 7))); mat!(match_basic_126, r"a*", r"aaa", Some((0, 3))); mat!(match_basic_128, r"(a*)*", r"-", Some((0, 0)), None); mat!(match_basic_129, r"(a*)+", r"-", Some((0, 0)), Some((0, 0))); mat!(match_basic_131, r"(a*|b)*", r"-", Some((0, 0)), None); mat!(match_basic_132, r"(a+|b)*", r"ab", Some((0, 2)), Some((1, 2))); mat!(match_basic_133, r"(a+|b)+", r"ab", Some((0, 2)), Some((1, 2))); mat!(match_basic_134, r"(a+|b)?", r"ab", Some((0, 1)), Some((0, 1))); mat!(match_basic_135, r"[^ab]*", r"cde", Some((0, 3))); mat!(match_basic_137, r"(^)*", r"-", Some((0, 0)), None); mat!(match_basic_138, r"a*", r"", Some((0, 0))); mat!(match_basic_139, r"([abc])*d", r"abbbcd", Some((0, 6)), Some((4, 5))); mat!(match_basic_140, r"([abc])*bcd", r"abcd", Some((0, 4)), Some((0, 1))); mat!(match_basic_141, r"a|b|c|d|e", r"e", Some((0, 1))); mat!(match_basic_142, r"(a|b|c|d|e)f", r"ef", Some((0, 2)), Some((0, 1))); mat!(match_basic_144, r"((a*|b))*", r"-", Some((0, 0)), None, None); mat!(match_basic_145, r"abcd*efg", r"abcdefg", Some((0, 7))); mat!(match_basic_146, r"ab*", r"xabyabbbz", Some((1, 3))); mat!(match_basic_147, r"ab*", r"xayabbbz", Some((1, 2))); mat!(match_basic_148, r"(ab|cd)e", r"abcde", Some((2, 5)), Some((2, 4))); mat!(match_basic_149, r"[abhgefdc]ij", r"hij", Some((0, 3))); mat!(match_basic_150, r"(a|b)c*d", r"abcd", Some((1, 4)), Some((1, 2))); mat!(match_basic_151, r"(ab|ab*)bc", r"abc", Some((0, 3)), Some((0, 1))); mat!(match_basic_152, r"a([bc]*)c*", r"abc", Some((0, 3)), Some((1, 3))); mat!(match_basic_153, r"a([bc]*)(c*d)", r"abcd", Some((0, 4)), Some((1, 3)), Some((3, 4))); mat!(match_basic_154, r"a([bc]+)(c*d)", r"abcd", Some((0, 4)), Some((1, 3)), Some((3, 4))); mat!(match_basic_155, r"a([bc]*)(c+d)", r"abcd", Some((0, 4)), Some((1, 2)), Some((2, 4))); mat!(match_basic_156, r"a[bcd]*dcdcde", r"adcdcde", Some((0, 7))); mat!(match_basic_157, r"(ab|a)b*c", r"abc", Some((0, 3)), Some((0, 2))); mat!(match_basic_158, r"((a)(b)c)(d)", r"abcd", Some((0, 4)), Some((0, 3)), Some((0, 1)), Some((1, 2)), Some((3, 4))); mat!(match_basic_159, r"[A-Za-z_][A-Za-z0-9_]*", r"alpha", Some((0, 5))); mat!(match_basic_160, r"^a(bc+|b[eh])g|.h$", r"abh", Some((1, 3))); mat!(match_basic_161, r"(bc+d$|ef*g.|h?i(j|k))", r"effgz", Some((0, 5)), Some((0, 5))); mat!(match_basic_162, r"(bc+d$|ef*g.|h?i(j|k))", r"ij", Some((0, 2)), Some((0, 2)), Some((1, 2))); mat!(match_basic_163, r"(bc+d$|ef*g.|h?i(j|k))", r"reffgz", Some((1, 6)), Some((1, 6))); mat!(match_basic_164, r"(((((((((a)))))))))", r"a", Some((0, 1)), Some((0, 1)), Some((0, 1)), Some((0, 1)), Some((0, 1)), Some((0, 1)), Some((0, 1)), Some((0, 1)), Some((0, 1)), Some((0, 1))); mat!(match_basic_165, r"multiple words", r"multiple words yeah", Some((0, 14))); mat!(match_basic_166, r"(.*)c(.*)", r"abcde", Some((0, 5)), Some((0, 2)), Some((3, 5))); mat!(match_basic_167, r"abcd", r"abcd", Some((0, 4))); mat!(match_basic_168, r"a(bc)d", r"abcd", Some((0, 4)), Some((1, 3))); mat!(match_basic_169, r"a[-]?c", r"ac", Some((0, 3))); mat!(match_basic_170, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muammar Qaddafi", Some((0, 15)), None, Some((10, 12))); mat!(match_basic_171, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Mo'ammar Gadhafi", Some((0, 16)), None, Some((11, 13))); mat!(match_basic_172, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muammar Kaddafi", Some((0, 15)), None, Some((10, 12))); mat!(match_basic_173, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muammar Qadhafi", Some((0, 15)), None, Some((10, 12))); mat!(match_basic_174, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muammar Gadafi", Some((0, 14)), None, Some((10, 11))); mat!(match_basic_175, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Mu'ammar Qadafi", Some((0, 15)), None, Some((11, 12))); mat!(match_basic_176, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Moamar Gaddafi", Some((0, 14)), None, Some((9, 11))); mat!(match_basic_177, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Mu'ammar Qadhdhafi", Some((0, 18)), None, Some((13, 15))); mat!(match_basic_178, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muammar Khaddafi", Some((0, 16)), None, Some((11, 13))); mat!(match_basic_179, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muammar Ghaddafy", Some((0, 16)), None, Some((11, 13))); mat!(match_basic_180, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muammar Ghadafi", Some((0, 15)), None, Some((11, 12))); mat!(match_basic_181, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muammar Ghaddafi", Some((0, 16)), None, Some((11, 13))); mat!(match_basic_182, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muamar Kaddafi", Some((0, 14)), None, Some((9, 11))); mat!(match_basic_183, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muammar Quathafi", Some((0, 16)), None, Some((11, 13))); mat!(match_basic_184, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Muammar Gheddafi", Some((0, 16)), None, Some((11, 13))); mat!(match_basic_185, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Moammar Khadafy", Some((0, 15)), None, Some((11, 12))); mat!(match_basic_186, r"M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", r"Moammar Qudhafi", Some((0, 15)), None, Some((10, 12))); mat!(match_basic_187, r"a+(b|c)*d+", r"aabcdd", Some((0, 6)), Some((3, 4))); mat!(match_basic_188, r"^.+$", r"vivi", Some((0, 4))); mat!(match_basic_189, r"^(.+)$", r"vivi", Some((0, 4)), Some((0, 4))); mat!(match_basic_190, r"^([^!.]+).att.com!(.+)$", r"gryphon.att.com!eby", Some((0, 19)), Some((0, 7)), Some((16, 19))); mat!(match_basic_191, r"^([^!]+!)?([^!]+)$", r"bas", Some((0, 3)), None, Some((0, 3))); mat!(match_basic_192, r"^([^!]+!)?([^!]+)$", r"bar!bas", Some((0, 7)), Some((0, 4)), Some((4, 7))); mat!(match_basic_193, r"^([^!]+!)?([^!]+)$", r"foo!bas", Some((0, 7)), Some((0, 4)), Some((4, 7))); mat!(match_basic_194, r"^.+!([^!]+!)([^!]+)$", r"foo!bar!bas", Some((0, 11)), Some((4, 8)), Some((8, 11))); mat!(match_basic_195, r"((foo)|(bar))!bas", r"bar!bas", Some((0, 7)), Some((0, 3)), None, Some((0, 3))); mat!(match_basic_196, r"((foo)|(bar))!bas", r"foo!bar!bas", Some((4, 11)), Some((4, 7)), None, Some((4, 7))); mat!(match_basic_197, r"((foo)|(bar))!bas", r"foo!bas", Some((0, 7)), Some((0, 3)), Some((0, 3))); mat!(match_basic_198, r"((foo)|bar)!bas", r"bar!bas", Some((0, 7)), Some((0, 3))); mat!(match_basic_199, r"((foo)|bar)!bas", r"foo!bar!bas", Some((4, 11)), Some((4, 7))); mat!(match_basic_200, r"((foo)|bar)!bas", r"foo!bas", Some((0, 7)), Some((0, 3)), Some((0, 3))); mat!(match_basic_201, r"(foo|(bar))!bas", r"bar!bas", Some((0, 7)), Some((0, 3)), Some((0, 3))); mat!(match_basic_202, r"(foo|(bar))!bas", r"foo!bar!bas", Some((4, 11)), Some((4, 7)), Some((4, 7))); mat!(match_basic_203, r"(foo|(bar))!bas", r"foo!bas", Some((0, 7)), Some((0, 3))); mat!(match_basic_204, r"(foo|bar)!bas", r"bar!bas", Some((0, 7)), Some((0, 3))); mat!(match_basic_205, r"(foo|bar)!bas", r"foo!bar!bas", Some((4, 11)), Some((4, 7))); mat!(match_basic_206, r"(foo|bar)!bas", r"foo!bas", Some((0, 7)), Some((0, 3))); mat!(match_basic_207, r"^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$", r"foo!bar!bas", Some((0, 11)), Some((0, 11)), None, None, Some((4, 8)), Some((8, 11))); mat!(match_basic_208, r"^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$", r"bas", Some((0, 3)), None, Some((0, 3))); mat!(match_basic_209, r"^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$", r"bar!bas", Some((0, 7)), Some((0, 4)), Some((4, 7))); mat!(match_basic_210, r"^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$", r"foo!bar!bas", Some((0, 11)), None, None, Some((4, 8)), Some((8, 11))); mat!(match_basic_211, r"^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$", r"foo!bas", Some((0, 7)), Some((0, 4)), Some((4, 7))); mat!(match_basic_212, r"^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$", r"bas", Some((0, 3)), Some((0, 3)), None, Some((0, 3))); mat!(match_basic_213, r"^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$", r"bar!bas", Some((0, 7)), Some((0, 7)), Some((0, 4)), Some((4, 7))); mat!(match_basic_214, r"^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$", r"foo!bar!bas", Some((0, 11)), Some((0, 11)), None, None, Some((4, 8)), Some((8, 11))); mat!(match_basic_215, r"^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$", r"foo!bas", Some((0, 7)), Some((0, 7)), Some((0, 4)), Some((4, 7))); mat!(match_basic_216, r".*(/XXX).*", r"/XXX", Some((0, 4)), Some((0, 4))); mat!(match_basic_217, r".*(\\XXX).*", r"\XXX", Some((0, 4)), Some((0, 4))); mat!(match_basic_218, r"\\XXX", r"\XXX", Some((0, 4))); mat!(match_basic_219, r".*(/000).*", r"/000", Some((0, 4)), Some((0, 4))); mat!(match_basic_220, r".*(\\000).*", r"\000", Some((0, 4)), Some((0, 4))); mat!(match_basic_221, r"\\000", r"\000", Some((0, 4))); // Tests from nullsubexpr.dat mat!(match_nullsubexpr_3, r"(a*)*", r"a", Some((0, 1)), Some((0, 1))); mat!(match_nullsubexpr_5, r"(a*)*", r"x", Some((0, 0)), None); mat!(match_nullsubexpr_6, r"(a*)*", r"aaaaaa", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_7, r"(a*)*", r"aaaaaax", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_8, r"(a*)+", r"a", Some((0, 1)), Some((0, 1))); mat!(match_nullsubexpr_9, r"(a*)+", r"x", Some((0, 0)), Some((0, 0))); mat!(match_nullsubexpr_10, r"(a*)+", r"aaaaaa", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_11, r"(a*)+", r"aaaaaax", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_12, r"(a+)*", r"a", Some((0, 1)), Some((0, 1))); mat!(match_nullsubexpr_13, r"(a+)*", r"x", Some((0, 0))); mat!(match_nullsubexpr_14, r"(a+)*", r"aaaaaa", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_15, r"(a+)*", r"aaaaaax", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_16, r"(a+)+", r"a", Some((0, 1)), Some((0, 1))); mat!(match_nullsubexpr_17, r"(a+)+", r"x", None); mat!(match_nullsubexpr_18, r"(a+)+", r"aaaaaa", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_19, r"(a+)+", r"aaaaaax", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_21, r"([a]*)*", r"a", Some((0, 1)), Some((0, 1))); mat!(match_nullsubexpr_23, r"([a]*)*", r"x", Some((0, 0)), None); mat!(match_nullsubexpr_24, r"([a]*)*", r"aaaaaa", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_25, r"([a]*)*", r"aaaaaax", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_26, r"([a]*)+", r"a", Some((0, 1)), Some((0, 1))); mat!(match_nullsubexpr_27, r"([a]*)+", r"x", Some((0, 0)), Some((0, 0))); mat!(match_nullsubexpr_28, r"([a]*)+", r"aaaaaa", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_29, r"([a]*)+", r"aaaaaax", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_30, r"([^b]*)*", r"a", Some((0, 1)), Some((0, 1))); mat!(match_nullsubexpr_32, r"([^b]*)*", r"b", Some((0, 0)), None); mat!(match_nullsubexpr_33, r"([^b]*)*", r"aaaaaa", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_34, r"([^b]*)*", r"aaaaaab", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_35, r"([ab]*)*", r"a", Some((0, 1)), Some((0, 1))); mat!(match_nullsubexpr_36, r"([ab]*)*", r"aaaaaa", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_37, r"([ab]*)*", r"ababab", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_38, r"([ab]*)*", r"bababa", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_39, r"([ab]*)*", r"b", Some((0, 1)), Some((0, 1))); mat!(match_nullsubexpr_40, r"([ab]*)*", r"bbbbbb", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_41, r"([ab]*)*", r"aaaabcde", Some((0, 5)), Some((0, 5))); mat!(match_nullsubexpr_42, r"([^a]*)*", r"b", Some((0, 1)), Some((0, 1))); mat!(match_nullsubexpr_43, r"([^a]*)*", r"bbbbbb", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_45, r"([^a]*)*", r"aaaaaa", Some((0, 0)), None); mat!(match_nullsubexpr_46, r"([^ab]*)*", r"ccccxx", Some((0, 6)), Some((0, 6))); mat!(match_nullsubexpr_48, r"([^ab]*)*", r"ababab", Some((0, 0)), None); mat!(match_nullsubexpr_50, r"((z)+|a)*", r"zabcde", Some((0, 2)), Some((1, 2))); mat!(match_nullsubexpr_69, r"(a*)*(x)", r"x", Some((0, 1)), None, Some((0, 1))); mat!(match_nullsubexpr_70, r"(a*)*(x)", r"ax", Some((0, 2)), Some((0, 1)), Some((1, 2))); mat!(match_nullsubexpr_71, r"(a*)*(x)", r"axa", Some((0, 2)), Some((0, 1)), Some((1, 2))); mat!(match_nullsubexpr_73, r"(a*)+(x)", r"x", Some((0, 1)), Some((0, 0)), Some((0, 1))); mat!(match_nullsubexpr_74, r"(a*)+(x)", r"ax", Some((0, 2)), Some((0, 1)), Some((1, 2))); mat!(match_nullsubexpr_75, r"(a*)+(x)", r"axa", Some((0, 2)), Some((0, 1)), Some((1, 2))); mat!(match_nullsubexpr_77, r"(a*){2}(x)", r"x", Some((0, 1)), Some((0, 0)), Some((0, 1))); mat!(match_nullsubexpr_78, r"(a*){2}(x)", r"ax", Some((0, 2)), Some((1, 1)), Some((1, 2))); mat!(match_nullsubexpr_79, r"(a*){2}(x)", r"axa", Some((0, 2)), Some((1, 1)), Some((1, 2))); // Tests from repetition.dat mat!(match_repetition_10, r"((..)|(.))", r"", None); mat!(match_repetition_11, r"((..)|(.))((..)|(.))", r"", None); mat!(match_repetition_12, r"((..)|(.))((..)|(.))((..)|(.))", r"", None); mat!(match_repetition_14, r"((..)|(.)){1}", r"", None); mat!(match_repetition_15, r"((..)|(.)){2}", r"", None); mat!(match_repetition_16, r"((..)|(.)){3}", r"", None); mat!(match_repetition_18, r"((..)|(.))*", r"", Some((0, 0))); mat!(match_repetition_20, r"((..)|(.))", r"a", Some((0, 1)), Some((0, 1)), None, Some((0, 1))); mat!(match_repetition_21, r"((..)|(.))((..)|(.))", r"a", None); mat!(match_repetition_22, r"((..)|(.))((..)|(.))((..)|(.))", r"a", None); mat!(match_repetition_24, r"((..)|(.)){1}", r"a", Some((0, 1)), Some((0, 1)), None, Some((0, 1))); mat!(match_repetition_25, r"((..)|(.)){2}", r"a", None); mat!(match_repetition_26, r"((..)|(.)){3}", r"a", None); mat!(match_repetition_28, r"((..)|(.))*", r"a", Some((0, 1)), Some((0, 1)), None, Some((0, 1))); mat!(match_repetition_30, r"((..)|(.))", r"aa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_31, r"((..)|(.))((..)|(.))", r"aa", Some((0, 2)), Some((0, 1)), None, Some((0, 1)), Some((1, 2)), None, Some((1, 2))); mat!(match_repetition_32, r"((..)|(.))((..)|(.))((..)|(.))", r"aa", None); mat!(match_repetition_34, r"((..)|(.)){1}", r"aa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_35, r"((..)|(.)){2}", r"aa", Some((0, 2)), Some((1, 2)), None, Some((1, 2))); mat!(match_repetition_36, r"((..)|(.)){3}", r"aa", None); mat!(match_repetition_38, r"((..)|(.))*", r"aa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_40, r"((..)|(.))", r"aaa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_41, r"((..)|(.))((..)|(.))", r"aaa", Some((0, 3)), Some((0, 2)), Some((0, 2)), None, Some((2, 3)), None, Some((2, 3))); mat!(match_repetition_42, r"((..)|(.))((..)|(.))((..)|(.))", r"aaa", Some((0, 3)), Some((0, 1)), None, Some((0, 1)), Some((1, 2)), None, Some((1, 2)), Some((2, 3)), None, Some((2, 3))); mat!(match_repetition_44, r"((..)|(.)){1}", r"aaa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_46, r"((..)|(.)){2}", r"aaa", Some((0, 3)), Some((2, 3)), Some((0, 2)), Some((2, 3))); mat!(match_repetition_47, r"((..)|(.)){3}", r"aaa", Some((0, 3)), Some((2, 3)), None, Some((2, 3))); mat!(match_repetition_50, r"((..)|(.))*", r"aaa", Some((0, 3)), Some((2, 3)), Some((0, 2)), Some((2, 3))); mat!(match_repetition_52, r"((..)|(.))", r"aaaa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_53, r"((..)|(.))((..)|(.))", r"aaaa", Some((0, 4)), Some((0, 2)), Some((0, 2)), None, Some((2, 4)), Some((2, 4)), None); mat!(match_repetition_54, r"((..)|(.))((..)|(.))((..)|(.))", r"aaaa", Some((0, 4)), Some((0, 2)), Some((0, 2)), None, Some((2, 3)), None, Some((2, 3)), Some((3, 4)), None, Some((3, 4))); mat!(match_repetition_56, r"((..)|(.)){1}", r"aaaa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_57, r"((..)|(.)){2}", r"aaaa", Some((0, 4)), Some((2, 4)), Some((2, 4)), None); mat!(match_repetition_59, r"((..)|(.)){3}", r"aaaa", Some((0, 4)), Some((3, 4)), Some((0, 2)), Some((3, 4))); mat!(match_repetition_61, r"((..)|(.))*", r"aaaa", Some((0, 4)), Some((2, 4)), Some((2, 4)), None); mat!(match_repetition_63, r"((..)|(.))", r"aaaaa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_64, r"((..)|(.))((..)|(.))", r"aaaaa", Some((0, 4)), Some((0, 2)), Some((0, 2)), None, Some((2, 4)), Some((2, 4)), None); mat!(match_repetition_65, r"((..)|(.))((..)|(.))((..)|(.))", r"aaaaa", Some((0, 5)), Some((0, 2)), Some((0, 2)), None, Some((2, 4)), Some((2, 4)), None, Some((4, 5)), None, Some((4, 5))); mat!(match_repetition_67, r"((..)|(.)){1}", r"aaaaa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_68, r"((..)|(.)){2}", r"aaaaa", Some((0, 4)), Some((2, 4)), Some((2, 4)), None); mat!(match_repetition_70, r"((..)|(.)){3}", r"aaaaa", Some((0, 5)), Some((4, 5)), Some((2, 4)), Some((4, 5))); mat!(match_repetition_73, r"((..)|(.))*", r"aaaaa", Some((0, 5)), Some((4, 5)), Some((2, 4)), Some((4, 5))); mat!(match_repetition_75, r"((..)|(.))", r"aaaaaa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_76, r"((..)|(.))((..)|(.))", r"aaaaaa", Some((0, 4)), Some((0, 2)), Some((0, 2)), None, Some((2, 4)), Some((2, 4)), None); mat!(match_repetition_77, r"((..)|(.))((..)|(.))((..)|(.))", r"aaaaaa", Some((0, 6)), Some((0, 2)), Some((0, 2)), None, Some((2, 4)), Some((2, 4)), None, Some((4, 6)), Some((4, 6)), None); mat!(match_repetition_79, r"((..)|(.)){1}", r"aaaaaa", Some((0, 2)), Some((0, 2)), Some((0, 2)), None); mat!(match_repetition_80, r"((..)|(.)){2}", r"aaaaaa", Some((0, 4)), Some((2, 4)), Some((2, 4)), None); mat!(match_repetition_81, r"((..)|(.)){3}", r"aaaaaa", Some((0, 6)), Some((4, 6)), Some((4, 6)), None); mat!(match_repetition_83, r"((..)|(.))*", r"aaaaaa", Some((0, 6)), Some((4, 6)), Some((4, 6)), None); mat!(match_repetition_90, r"X(.?){0,}Y", r"X1234567Y", Some((0, 9)), Some((7, 8))); mat!(match_repetition_91, r"X(.?){1,}Y", r"X1234567Y", Some((0, 9)), Some((7, 8))); mat!(match_repetition_92, r"X(.?){2,}Y", r"X1234567Y", Some((0, 9)), Some((7, 8))); mat!(match_repetition_93, r"X(.?){3,}Y", r"X1234567Y", Some((0, 9)), Some((7, 8))); mat!(match_repetition_94, r"X(.?){4,}Y", r"X1234567Y", Some((0, 9)), Some((7, 8))); mat!(match_repetition_95, r"X(.?){5,}Y", r"X1234567Y", Some((0, 9)), Some((7, 8))); mat!(match_repetition_96, r"X(.?){6,}Y", r"X1234567Y", Some((0, 9)), Some((7, 8))); mat!(match_repetition_97, r"X(.?){7,}Y", r"X1234567Y", Some((0, 9)), Some((7, 8))); mat!(match_repetition_98, r"X(.?){8,}Y", r"X1234567Y", Some((0, 9)), Some((8, 8))); mat!(match_repetition_100, r"X(.?){0,8}Y", r"X1234567Y", Some((0, 9)), Some((8, 8))); mat!(match_repetition_102, r"X(.?){1,8}Y", r"X1234567Y", Some((0, 9)), Some((8, 8))); mat!(match_repetition_104, r"X(.?){2,8}Y", r"X1234567Y", Some((0, 9)), Some((8, 8))); mat!(match_repetition_106, r"X(.?){3,8}Y", r"X1234567Y", Some((0, 9)), Some((8, 8))); mat!(match_repetition_108, r"X(.?){4,8}Y", r"X1234567Y", Some((0, 9)), Some((8, 8))); mat!(match_repetition_110, r"X(.?){5,8}Y", r"X1234567Y", Some((0, 9)), Some((8, 8))); mat!(match_repetition_112, r"X(.?){6,8}Y", r"X1234567Y", Some((0, 9)), Some((8, 8))); mat!(match_repetition_114, r"X(.?){7,8}Y", r"X1234567Y", Some((0, 9)), Some((8, 8))); mat!(match_repetition_115, r"X(.?){8,8}Y", r"X1234567Y", Some((0, 9)), Some((8, 8))); mat!(match_repetition_126, r"(a|ab|c|bcd){0,}(d*)", r"ababcd", Some((0, 1)), Some((0, 1)), Some((1, 1))); mat!(match_repetition_127, r"(a|ab|c|bcd){1,}(d*)", r"ababcd", Some((0, 1)), Some((0, 1)), Some((1, 1))); mat!(match_repetition_128, r"(a|ab|c|bcd){2,}(d*)", r"ababcd", Some((0, 6)), Some((3, 6)), Some((6, 6))); mat!(match_repetition_129, r"(a|ab|c|bcd){3,}(d*)", r"ababcd", Some((0, 6)), Some((3, 6)), Some((6, 6))); mat!(match_repetition_130, r"(a|ab|c|bcd){4,}(d*)", r"ababcd", None); mat!(match_repetition_131, r"(a|ab|c|bcd){0,10}(d*)", r"ababcd", Some((0, 1)), Some((0, 1)), Some((1, 1))); mat!(match_repetition_132, r"(a|ab|c|bcd){1,10}(d*)", r"ababcd", Some((0, 1)), Some((0, 1)), Some((1, 1))); mat!(match_repetition_133, r"(a|ab|c|bcd){2,10}(d*)", r"ababcd", Some((0, 6)), Some((3, 6)), Some((6, 6))); mat!(match_repetition_134, r"(a|ab|c|bcd){3,10}(d*)", r"ababcd", Some((0, 6)), Some((3, 6)), Some((6, 6))); mat!(match_repetition_135, r"(a|ab|c|bcd){4,10}(d*)", r"ababcd", None); mat!(match_repetition_136, r"(a|ab|c|bcd)*(d*)", r"ababcd", Some((0, 1)), Some((0, 1)), Some((1, 1))); mat!(match_repetition_137, r"(a|ab|c|bcd)+(d*)", r"ababcd", Some((0, 1)), Some((0, 1)), Some((1, 1))); mat!(match_repetition_143, r"(ab|a|c|bcd){0,}(d*)", r"ababcd", Some((0, 6)), Some((4, 5)), Some((5, 6))); mat!(match_repetition_145, r"(ab|a|c|bcd){1,}(d*)", r"ababcd", Some((0, 6)), Some((4, 5)), Some((5, 6))); mat!(match_repetition_147, r"(ab|a|c|bcd){2,}(d*)", r"ababcd", Some((0, 6)), Some((4, 5)), Some((5, 6))); mat!(match_repetition_149, r"(ab|a|c|bcd){3,}(d*)", r"ababcd", Some((0, 6)), Some((4, 5)), Some((5, 6))); mat!(match_repetition_150, r"(ab|a|c|bcd){4,}(d*)", r"ababcd", None); mat!(match_repetition_152, r"(ab|a|c|bcd){0,10}(d*)", r"ababcd", Some((0, 6)), Some((4, 5)), Some((5, 6))); mat!(match_repetition_154, r"(ab|a|c|bcd){1,10}(d*)", r"ababcd", Some((0, 6)), Some((4, 5)), Some((5, 6))); mat!(match_repetition_156, r"(ab|a|c|bcd){2,10}(d*)", r"ababcd", Some((0, 6)), Some((4, 5)), Some((5, 6))); mat!(match_repetition_158, r"(ab|a|c|bcd){3,10}(d*)", r"ababcd", Some((0, 6)), Some((4, 5)), Some((5, 6))); mat!(match_repetition_159, r"(ab|a|c|bcd){4,10}(d*)", r"ababcd", None); mat!(match_repetition_161, r"(ab|a|c|bcd)*(d*)", r"ababcd", Some((0, 6)), Some((4, 5)), Some((5, 6))); mat!(match_repetition_163, r"(ab|a|c|bcd)+(d*)", r"ababcd", Some((0, 6)), Some((4, 5)), Some((5, 6))); // Some crazy expressions from regular-expressions.info. mat!(match_ranges, r"\b(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b", "num: 255", Some((5, 8))); mat!(match_ranges_not, r"\b(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b", "num: 256", None); mat!(match_float1, r"[-+]?[0-9]*\.?[0-9]+", "0.1", Some((0, 3))); mat!(match_float2, r"[-+]?[0-9]*\.?[0-9]+", "0.1.2", Some((0, 3))); mat!(match_float3, r"[-+]?[0-9]*\.?[0-9]+", "a1.2", Some((1, 4))); mat!(match_float4, r"^[-+]?[0-9]*\.?[0-9]+$", "1.a", None); mat!(match_email, r"(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b", "mine is jam.slam@gmail.com ", Some((8, 26))); mat!(match_email_not, r"(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b", "mine is jam.slam@gmail ", None); mat!(match_email_big, r"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", "mine is jam.slam@gmail.com ", Some((8, 26))); mat!(match_date1, r"^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$", "1900-01-01", Some((0, 10))); mat!(match_date2, r"^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$", "1900-00-01", None); mat!(match_date3, r"^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$", "1900-13-01", None); // Exercise the flags. mat!(match_flag_case, "(?i)abc", "ABC", Some((0, 3))); mat!(match_flag_weird_case, "(?i)a(?-i)bc", "Abc", Some((0, 3))); mat!(match_flag_weird_case_not, "(?i)a(?-i)bc", "ABC", None); mat!(match_flag_case_dotnl, "(?is)a.", "A\n", Some((0, 2))); mat!(match_flag_case_dotnl_cr, "(?is)a.", "A\r", Some((0, 2))); mat!(match_flag_case_dotnl_toggle, "(?is)a.(?-is)a.", "A\nab", Some((0, 4))); mat!(match_flag_case_dotnl_toggle_not, "(?is)a.(?-is)a.", "A\na\n", None); mat!(match_flag_case_dotnl_toggle_ok, "(?is)a.(?-is:a.)?", "A\na\n", Some((0, 2))); mat!(match_flag_multi, "(?m)(?:^\\d+$\n?)+", "123\n456\n789", Some((0, 11))); mat!(match_flag_ungreedy, "(?U)a+", "aa", Some((0, 1))); mat!(match_flag_ungreedy_greedy, "(?U)a+?", "aa", Some((0, 2))); mat!(match_flag_ungreedy_noop, "(?U)(?-U)a+", "aa", Some((0, 2))); // Some Unicode tests. // A couple of these are commented out because something in the guts of macro // expansion is creating invalid byte strings. // mat!(uni_literal, r"Ⅰ", "Ⅰ", Some((0, 3))) // mat!(uni_case_not, r"Δ", "δ", None) mat!(uni_one, r"\pN", "Ⅰ", Some((0, 3))); mat!(uni_mixed, r"\pN+", "Ⅰ1Ⅱ2", Some((0, 8))); mat!(uni_not, r"\PN+", "abⅠ", Some((0, 2))); mat!(uni_not_class, r"[\PN]+", "abⅠ", Some((0, 2))); mat!(uni_not_class_neg, r"[^\PN]+", "abⅠ", Some((2, 5))); mat!(uni_case, r"(?i)Δ", "δ", Some((0, 2))); mat!(uni_case_upper, r"\p{Lu}+", "ΛΘΓΔα", Some((0, 8))); mat!(uni_case_upper_nocase_flag, r"(?i)\p{Lu}+", "ΛΘΓΔα", Some((0, 10))); mat!(uni_case_upper_nocase, r"\p{L}+", "ΛΘΓΔα", Some((0, 10))); mat!(uni_case_lower, r"\p{Ll}+", "ΛΘΓΔα", Some((8, 10))); // https://github.com/rust-lang/regex/issues/76 mat!(uni_case_lower_nocase_flag, r"(?i)\p{Ll}+", "ΛΘΓΔα", Some((0, 10))); // Test the Unicode friendliness of Perl character classes. mat!(uni_perl_w, r"\w+", "dδd", Some((0, 4))); mat!(uni_perl_w_not, r"\w+", "⥡", None); mat!(uni_perl_w_neg, r"\W+", "⥡", Some((0, 3))); mat!(uni_perl_d, r"\d+", "1२३9", Some((0, 8))); mat!(uni_perl_d_not, r"\d+", "Ⅱ", None); mat!(uni_perl_d_neg, r"\D+", "Ⅱ", Some((0, 3))); mat!(uni_perl_s, r"\s+", " ", Some((0, 3))); mat!(uni_perl_s_not, r"\s+", "☃", None); mat!(uni_perl_s_neg, r"\S+", "☃", Some((0, 3))); // And do the same for word boundaries. mat!(uni_boundary_none, r"\d\b", "6δ", None); mat!(uni_boundary_ogham, r"\d\b", "6 ", Some((0, 1))); // Word boundaries in the middle of text. mat!(boundary_mid, r"\btest\b", "This is a test.", Some((10, 14))); mat!(boundary_mid_uni, r"\bהחומוס\b", "למי יש את החומוס הכי טוב בארץ?", Some((17, 29))); // Doubled word boundaries. mat!(boundary_doubled, r"\b\btest\b\b", "This is a test.", Some((10, 14))); mat!(boundary_doubled_whole, r"\b\btest\b\b", "test", Some((0, 4))); mat!(boundary_rep, r"(\btest\b *)+end", "This is a test test test end.", Some((10, 28))); // Test negated character classes. mat!(negclass_letters, r"[^ac]", "acx", Some((2, 3))); mat!(negclass_letter_comma, r"[^a,]", "a,x", Some((2, 3))); mat!(negclass_letter_space, r"[^a\s]", "a x", Some((2, 3))); mat!(negclass_comma, r"[^,]", ",,x", Some((2, 3))); mat!(negclass_space, r"[^\s]", " a", Some((1, 2))); mat!(negclass_space_comma, r"[^,\s]", ", a", Some((2, 3))); mat!(negclass_comma_space, r"[^\s,]", " ,a", Some((2, 3))); mat!(negclass_ascii, r"[^[:alpha:]Z]", "A1", Some((1, 2))); // Regression test for https://github.com/rust-lang/regex/issues/75 mat!(regression_unsorted_binary_search_1, r"(?i)[a_]+", "A_", Some((0, 2))); mat!(regression_unsorted_binary_search_2, r"(?i)[A_]+", "a_", Some((0, 2))); // Regression tests for https://github.com/rust-lang/regex/issues/99 mat!(regression_negated_char_class_1, r"(?i)[^x]", "x", None); mat!(regression_negated_char_class_2, r"(?i)[^x]", "X", None); // Regression test for https://github.com/rust-lang/regex/issues/101 mat!(regression_ascii_word_underscore, r"[:word:]", "_", Some((0, 1))); // Examples from python's test suite. mat!(match_python_000, "(?Pa)", "a", Some((0, 1))); mat!(match_python_001, "[\\1]", "\u{0001}", Some((0, 1))); mat!(match_python_002, "\\09", "\u{0000}9", Some((0, 2))); mat!(match_python_003, "\\141", "a", Some((0, 1))); mat!(match_python_004, "\\0", "\u{0000}", Some((0, 1))); mat!(match_python_005, "[\\0a]", "\u{0000}", Some((0, 1))); mat!(match_python_006, "[a\\0]", "\u{0000}", Some((0, 1))); mat!(match_python_007, "a.b", "acb", Some((0, 3))); mat!(match_python_008, "(?s)a.b", "a\nb", Some((0, 3))); mat!(match_python_009, "(?s)a.{4,5}b", "acc\nccb", Some((0, 7))); mat!(match_python_010, "(?s)a.b", "a\nb", Some((0, 3))); mat!(match_python_011, "abc", "abc", Some((0, 3))); mat!(match_python_012, "abc", "xabcy", Some((1, 4))); mat!(match_python_013, "abc", "ababc", Some((2, 5))); mat!(match_python_014, "ab*c", "abc", Some((0, 3))); mat!(match_python_015, "ab*bc", "abc", Some((0, 3))); mat!(match_python_016, "ab*bc", "abbc", Some((0, 4))); mat!(match_python_017, "ab*bc", "abbbbc", Some((0, 6))); mat!(match_python_018, "ab+bc", "abbc", Some((0, 4))); mat!(match_python_019, "ab+bc", "abbbbc", Some((0, 6))); mat!(match_python_020, "ab?bc", "abbc", Some((0, 4))); mat!(match_python_021, "ab?bc", "abc", Some((0, 3))); mat!(match_python_022, "ab?c", "abc", Some((0, 3))); mat!(match_python_023, "^abc$", "abc", Some((0, 3))); mat!(match_python_024, "^abc", "abcc", Some((0, 3))); mat!(match_python_025, "abc$", "aabc", Some((1, 4))); mat!(match_python_026, "^", "abc", Some((0, 0))); mat!(match_python_027, "$", "abc", Some((3, 3))); mat!(match_python_028, "a.c", "abc", Some((0, 3))); mat!(match_python_029, "a.c", "axc", Some((0, 3))); mat!(match_python_030, "a.*c", "axyzc", Some((0, 5))); mat!(match_python_031, "a[bc]d", "abd", Some((0, 3))); mat!(match_python_032, "a[b-d]e", "ace", Some((0, 3))); mat!(match_python_033, "a[b-d]", "aac", Some((1, 3))); mat!(match_python_034, "a[-b]", "a-", Some((0, 2))); mat!(match_python_035, "a]", "a]", Some((0, 2))); mat!(match_python_036, "a[]]b", "a]b", Some((0, 3))); mat!(match_python_037, "a[\\]]b", "a]b", Some((0, 3))); mat!(match_python_038, "a[^bc]d", "aed", Some((0, 3))); mat!(match_python_039, "a[^-b]c", "adc", Some((0, 3))); mat!(match_python_040, "a[^]b]c", "adc", Some((0, 3))); mat!(match_python_041, "\\ba\\b", "a-", Some((0, 1))); mat!(match_python_042, "\\ba\\b", "-a", Some((1, 2))); mat!(match_python_043, "\\ba\\b", "-a-", Some((1, 2))); mat!(match_python_044, "x\\B", "xyz", Some((0, 1))); mat!(match_python_045, "\\Bz", "xyz", Some((2, 3))); mat!(match_python_046, "\\By\\b", "xy", Some((1, 2))); mat!(match_python_047, "\\by\\B", "yz", Some((0, 1))); mat!(match_python_048, "\\By\\B", "xyz", Some((1, 2))); mat!(match_python_049, "ab|cd", "abc", Some((0, 2))); mat!(match_python_050, "ab|cd", "abcd", Some((0, 2))); mat!(match_python_051, "a\\(b", "a(b", Some((0, 3))); mat!(match_python_052, "a\\(*b", "ab", Some((0, 2))); mat!(match_python_053, "a\\(*b", "a((b", Some((0, 4))); mat!(match_python_054, "a\\\\b", "a\\b", Some((0, 3))); mat!(match_python_055, "((a))", "abc", Some((0, 1))); mat!(match_python_056, "(a)b(c)", "abc", Some((0, 3))); mat!(match_python_057, "a+b+c", "aabbabc", Some((4, 7))); mat!(match_python_058, "(a+|b)*", "ab", Some((0, 2))); mat!(match_python_059, "(a+|b)+", "ab", Some((0, 2))); mat!(match_python_060, "(a+|b)?", "ab", Some((0, 1))); mat!(match_python_061, "[^ab]*", "cde", Some((0, 3))); mat!(match_python_062, "a*", "", Some((0, 0))); mat!(match_python_063, "a|b|c|d|e", "e", Some((0, 1))); mat!(match_python_064, "(a|b|c|d|e)f", "ef", Some((0, 2))); mat!(match_python_065, "abcd*efg", "abcdefg", Some((0, 7))); mat!(match_python_066, "ab*", "xabyabbbz", Some((1, 3))); mat!(match_python_067, "ab*", "xayabbbz", Some((1, 2))); mat!(match_python_068, "(ab|cd)e", "abcde", Some((2, 5))); mat!(match_python_069, "[abhgefdc]ij", "hij", Some((0, 3))); mat!(match_python_070, "(a|b)c*d", "abcd", Some((1, 4))); mat!(match_python_071, "(ab|ab*)bc", "abc", Some((0, 3))); mat!(match_python_072, "a([bc]*)c*", "abc", Some((0, 3))); mat!(match_python_073, "a([bc]*)(c*d)", "abcd", Some((0, 4))); mat!(match_python_074, "a([bc]+)(c*d)", "abcd", Some((0, 4))); mat!(match_python_075, "a([bc]*)(c+d)", "abcd", Some((0, 4))); mat!(match_python_076, "a[bcd]*dcdcde", "adcdcde", Some((0, 7))); mat!(match_python_077, "(ab|a)b*c", "abc", Some((0, 3))); mat!(match_python_078, "((a)(b)c)(d)", "abcd", Some((0, 4))); mat!(match_python_079, "[a-zA-Z_][a-zA-Z0-9_]*", "alpha", Some((0, 5))); mat!(match_python_080, "^a(bc+|b[eh])g|.h$", "abh", Some((1, 3))); mat!(match_python_081, "(bc+d$|ef*g.|h?i(j|k))", "effgz", Some((0, 5))); mat!(match_python_082, "(bc+d$|ef*g.|h?i(j|k))", "ij", Some((0, 2))); mat!(match_python_083, "(bc+d$|ef*g.|h?i(j|k))", "reffgz", Some((1, 6))); mat!(match_python_084, "(((((((((a)))))))))", "a", Some((0, 1))); mat!(match_python_085, "multiple words", "multiple words, yeah", Some((0, 14))); mat!(match_python_086, "(.*)c(.*)", "abcde", Some((0, 5))); mat!(match_python_087, "\\((.*), (.*)\\)", "(a, b)", Some((0, 6))); mat!(match_python_088, "a[-]?c", "ac", Some((0, 2))); mat!(match_python_089, "^(.+)?B", "AB", Some((0, 2))); mat!(match_python_090, "(a)(b)c|ab", "ab", Some((0, 2))); mat!(match_python_091, "(a)+x", "aaax", Some((0, 4))); mat!(match_python_092, "([ac])+x", "aacx", Some((0, 4))); mat!(match_python_093, "([^/]*/)*sub1/", "d:msgs/tdir/sub1/trial/away.cpp", Some((0, 17))); mat!(match_python_094, "([^.]*)\\.([^:]*):[T ]+(.*)", "track1.title:TBlah blah blah", Some((0, 28))); mat!(match_python_095, "([^N]*N)+", "abNNxyzN", Some((0, 8))); mat!(match_python_096, "([^N]*N)+", "abNNxyz", Some((0, 4))); mat!(match_python_097, "([abc]*)x", "abcx", Some((0, 4))); mat!(match_python_098, "([xyz]*)x", "abcx", Some((3, 4))); mat!(match_python_099, "(a)+b|aac", "aac", Some((0, 3))); mat!(match_python_100, "(?Paaa)a", "aaaa", Some((0, 4))); mat!(match_python_102, "\\141", "a", Some((0, 1))); mat!(match_python_103, "abc", "abc", Some((0, 3))); mat!(match_python_104, "abc", "xabcy", Some((1, 4))); mat!(match_python_105, "abc", "ababc", Some((2, 5))); mat!(match_python_106, "ab*c", "abc", Some((0, 3))); mat!(match_python_107, "ab*bc", "abc", Some((0, 3))); mat!(match_python_108, "ab*bc", "abbc", Some((0, 4))); mat!(match_python_109, "ab*bc", "abbbbc", Some((0, 6))); mat!(match_python_110, "ab{0,}bc", "abbbbc", Some((0, 6))); mat!(match_python_111, "ab+bc", "abbc", Some((0, 4))); mat!(match_python_112, "ab+bc", "abbbbc", Some((0, 6))); mat!(match_python_113, "ab{1,}bc", "abbbbc", Some((0, 6))); mat!(match_python_114, "ab{1,3}bc", "abbbbc", Some((0, 6))); mat!(match_python_115, "ab{3,4}bc", "abbbbc", Some((0, 6))); mat!(match_python_116, "ab?bc", "abbc", Some((0, 4))); mat!(match_python_117, "ab?bc", "abc", Some((0, 3))); mat!(match_python_118, "ab{0,1}bc", "abc", Some((0, 3))); mat!(match_python_119, "ab?c", "abc", Some((0, 3))); mat!(match_python_120, "ab{0,1}c", "abc", Some((0, 3))); mat!(match_python_121, "^abc$", "abc", Some((0, 3))); mat!(match_python_122, "^abc", "abcc", Some((0, 3))); mat!(match_python_123, "abc$", "aabc", Some((1, 4))); mat!(match_python_124, "^", "abc", Some((0, 0))); mat!(match_python_125, "$", "abc", Some((3, 3))); mat!(match_python_126, "a.c", "abc", Some((0, 3))); mat!(match_python_127, "a.c", "axc", Some((0, 3))); mat!(match_python_128, "a.*c", "axyzc", Some((0, 5))); mat!(match_python_129, "a[bc]d", "abd", Some((0, 3))); mat!(match_python_130, "a[b-d]e", "ace", Some((0, 3))); mat!(match_python_131, "a[b-d]", "aac", Some((1, 3))); mat!(match_python_132, "a[-b]", "a-", Some((0, 2))); mat!(match_python_133, "a[b-]", "a-", Some((0, 2))); mat!(match_python_134, "a]", "a]", Some((0, 2))); mat!(match_python_135, "a[]]b", "a]b", Some((0, 3))); mat!(match_python_136, "a[^bc]d", "aed", Some((0, 3))); mat!(match_python_137, "a[^-b]c", "adc", Some((0, 3))); mat!(match_python_138, "a[^]b]c", "adc", Some((0, 3))); mat!(match_python_139, "ab|cd", "abc", Some((0, 2))); mat!(match_python_140, "ab|cd", "abcd", Some((0, 2))); mat!(match_python_141, "a\\(b", "a(b", Some((0, 3))); mat!(match_python_142, "a\\(*b", "ab", Some((0, 2))); mat!(match_python_143, "a\\(*b", "a((b", Some((0, 4))); mat!(match_python_144, "a\\\\b", "a\\b", Some((0, 3))); mat!(match_python_145, "((a))", "abc", Some((0, 1))); mat!(match_python_146, "(a)b(c)", "abc", Some((0, 3))); mat!(match_python_147, "a+b+c", "aabbabc", Some((4, 7))); mat!(match_python_148, "a{1,}b{1,}c", "aabbabc", Some((4, 7))); mat!(match_python_149, "a.+?c", "abcabc", Some((0, 3))); mat!(match_python_150, "(a+|b)*", "ab", Some((0, 2))); mat!(match_python_151, "(a+|b){0,}", "ab", Some((0, 2))); mat!(match_python_152, "(a+|b)+", "ab", Some((0, 2))); mat!(match_python_153, "(a+|b){1,}", "ab", Some((0, 2))); mat!(match_python_154, "(a+|b)?", "ab", Some((0, 1))); mat!(match_python_155, "(a+|b){0,1}", "ab", Some((0, 1))); mat!(match_python_156, "[^ab]*", "cde", Some((0, 3))); mat!(match_python_157, "a*", "", Some((0, 0))); mat!(match_python_158, "([abc])*d", "abbbcd", Some((0, 6))); mat!(match_python_159, "([abc])*bcd", "abcd", Some((0, 4))); mat!(match_python_160, "a|b|c|d|e", "e", Some((0, 1))); mat!(match_python_161, "(a|b|c|d|e)f", "ef", Some((0, 2))); mat!(match_python_162, "abcd*efg", "abcdefg", Some((0, 7))); mat!(match_python_163, "ab*", "xabyabbbz", Some((1, 3))); mat!(match_python_164, "ab*", "xayabbbz", Some((1, 2))); mat!(match_python_165, "(ab|cd)e", "abcde", Some((2, 5))); mat!(match_python_166, "[abhgefdc]ij", "hij", Some((0, 3))); mat!(match_python_167, "(a|b)c*d", "abcd", Some((1, 4))); mat!(match_python_168, "(ab|ab*)bc", "abc", Some((0, 3))); mat!(match_python_169, "a([bc]*)c*", "abc", Some((0, 3))); mat!(match_python_170, "a([bc]*)(c*d)", "abcd", Some((0, 4))); mat!(match_python_171, "a([bc]+)(c*d)", "abcd", Some((0, 4))); mat!(match_python_172, "a([bc]*)(c+d)", "abcd", Some((0, 4))); mat!(match_python_173, "a[bcd]*dcdcde", "adcdcde", Some((0, 7))); mat!(match_python_174, "(ab|a)b*c", "abc", Some((0, 3))); mat!(match_python_175, "((a)(b)c)(d)", "abcd", Some((0, 4))); mat!(match_python_176, "[a-zA-Z_][a-zA-Z0-9_]*", "alpha", Some((0, 5))); mat!(match_python_177, "^a(bc+|b[eh])g|.h$", "abh", Some((1, 3))); mat!(match_python_178, "(bc+d$|ef*g.|h?i(j|k))", "effgz", Some((0, 5))); mat!(match_python_179, "(bc+d$|ef*g.|h?i(j|k))", "ij", Some((0, 2))); mat!(match_python_180, "(bc+d$|ef*g.|h?i(j|k))", "reffgz", Some((1, 6))); mat!(match_python_181, "((((((((((a))))))))))", "a", Some((0, 1))); mat!(match_python_182, "(((((((((a)))))))))", "a", Some((0, 1))); mat!(match_python_183, "multiple words", "multiple words, yeah", Some((0, 14))); mat!(match_python_184, "(.*)c(.*)", "abcde", Some((0, 5))); mat!(match_python_185, "\\((.*), (.*)\\)", "(a, b)", Some((0, 6))); mat!(match_python_186, "a[-]?c", "ac", Some((0, 2))); mat!(match_python_187, "(?i)abc", "ABC", Some((0, 3))); mat!(match_python_188, "(?i)abc", "XABCY", Some((1, 4))); mat!(match_python_189, "(?i)abc", "ABABC", Some((2, 5))); mat!(match_python_190, "(?i)ab*c", "ABC", Some((0, 3))); mat!(match_python_191, "(?i)ab*bc", "ABC", Some((0, 3))); mat!(match_python_192, "(?i)ab*bc", "ABBC", Some((0, 4))); mat!(match_python_193, "(?i)ab*?bc", "ABBBBC", Some((0, 6))); mat!(match_python_194, "(?i)ab{0,}?bc", "ABBBBC", Some((0, 6))); mat!(match_python_195, "(?i)ab+?bc", "ABBC", Some((0, 4))); mat!(match_python_196, "(?i)ab+bc", "ABBBBC", Some((0, 6))); mat!(match_python_197, "(?i)ab{1,}?bc", "ABBBBC", Some((0, 6))); mat!(match_python_198, "(?i)ab{1,3}?bc", "ABBBBC", Some((0, 6))); mat!(match_python_199, "(?i)ab{3,4}?bc", "ABBBBC", Some((0, 6))); mat!(match_python_200, "(?i)ab??bc", "ABBC", Some((0, 4))); mat!(match_python_201, "(?i)ab??bc", "ABC", Some((0, 3))); mat!(match_python_202, "(?i)ab{0,1}?bc", "ABC", Some((0, 3))); mat!(match_python_203, "(?i)ab??c", "ABC", Some((0, 3))); mat!(match_python_204, "(?i)ab{0,1}?c", "ABC", Some((0, 3))); mat!(match_python_205, "(?i)^abc$", "ABC", Some((0, 3))); mat!(match_python_206, "(?i)^abc", "ABCC", Some((0, 3))); mat!(match_python_207, "(?i)abc$", "AABC", Some((1, 4))); mat!(match_python_208, "(?i)^", "ABC", Some((0, 0))); mat!(match_python_209, "(?i)$", "ABC", Some((3, 3))); mat!(match_python_210, "(?i)a.c", "ABC", Some((0, 3))); mat!(match_python_211, "(?i)a.c", "AXC", Some((0, 3))); mat!(match_python_212, "(?i)a.*?c", "AXYZC", Some((0, 5))); mat!(match_python_213, "(?i)a[bc]d", "ABD", Some((0, 3))); mat!(match_python_214, "(?i)a[b-d]e", "ACE", Some((0, 3))); mat!(match_python_215, "(?i)a[b-d]", "AAC", Some((1, 3))); mat!(match_python_216, "(?i)a[-b]", "A-", Some((0, 2))); mat!(match_python_217, "(?i)a[b-]", "A-", Some((0, 2))); mat!(match_python_218, "(?i)a]", "A]", Some((0, 2))); mat!(match_python_219, "(?i)a[]]b", "A]B", Some((0, 3))); mat!(match_python_220, "(?i)a[^bc]d", "AED", Some((0, 3))); mat!(match_python_221, "(?i)a[^-b]c", "ADC", Some((0, 3))); mat!(match_python_222, "(?i)a[^]b]c", "ADC", Some((0, 3))); mat!(match_python_223, "(?i)ab|cd", "ABC", Some((0, 2))); mat!(match_python_224, "(?i)ab|cd", "ABCD", Some((0, 2))); mat!(match_python_225, "(?i)a\\(b", "A(B", Some((0, 3))); mat!(match_python_226, "(?i)a\\(*b", "AB", Some((0, 2))); mat!(match_python_227, "(?i)a\\(*b", "A((B", Some((0, 4))); mat!(match_python_228, "(?i)a\\\\b", "A\\B", Some((0, 3))); mat!(match_python_229, "(?i)((a))", "ABC", Some((0, 1))); mat!(match_python_230, "(?i)(a)b(c)", "ABC", Some((0, 3))); mat!(match_python_231, "(?i)a+b+c", "AABBABC", Some((4, 7))); mat!(match_python_232, "(?i)a{1,}b{1,}c", "AABBABC", Some((4, 7))); mat!(match_python_233, "(?i)a.+?c", "ABCABC", Some((0, 3))); mat!(match_python_234, "(?i)a.*?c", "ABCABC", Some((0, 3))); mat!(match_python_235, "(?i)a.{0,5}?c", "ABCABC", Some((0, 3))); mat!(match_python_236, "(?i)(a+|b)*", "AB", Some((0, 2))); mat!(match_python_237, "(?i)(a+|b){0,}", "AB", Some((0, 2))); mat!(match_python_238, "(?i)(a+|b)+", "AB", Some((0, 2))); mat!(match_python_239, "(?i)(a+|b){1,}", "AB", Some((0, 2))); mat!(match_python_240, "(?i)(a+|b)?", "AB", Some((0, 1))); mat!(match_python_241, "(?i)(a+|b){0,1}", "AB", Some((0, 1))); mat!(match_python_242, "(?i)(a+|b){0,1}?", "AB", Some((0, 0))); mat!(match_python_243, "(?i)[^ab]*", "CDE", Some((0, 3))); mat!(match_python_244, "(?i)a*", "", Some((0, 0))); mat!(match_python_245, "(?i)([abc])*d", "ABBBCD", Some((0, 6))); mat!(match_python_246, "(?i)([abc])*bcd", "ABCD", Some((0, 4))); mat!(match_python_247, "(?i)a|b|c|d|e", "E", Some((0, 1))); mat!(match_python_248, "(?i)(a|b|c|d|e)f", "EF", Some((0, 2))); mat!(match_python_249, "(?i)abcd*efg", "ABCDEFG", Some((0, 7))); mat!(match_python_250, "(?i)ab*", "XABYABBBZ", Some((1, 3))); mat!(match_python_251, "(?i)ab*", "XAYABBBZ", Some((1, 2))); mat!(match_python_252, "(?i)(ab|cd)e", "ABCDE", Some((2, 5))); mat!(match_python_253, "(?i)[abhgefdc]ij", "HIJ", Some((0, 3))); mat!(match_python_254, "(?i)(a|b)c*d", "ABCD", Some((1, 4))); mat!(match_python_255, "(?i)(ab|ab*)bc", "ABC", Some((0, 3))); mat!(match_python_256, "(?i)a([bc]*)c*", "ABC", Some((0, 3))); mat!(match_python_257, "(?i)a([bc]*)(c*d)", "ABCD", Some((0, 4))); mat!(match_python_258, "(?i)a([bc]+)(c*d)", "ABCD", Some((0, 4))); mat!(match_python_259, "(?i)a([bc]*)(c+d)", "ABCD", Some((0, 4))); mat!(match_python_260, "(?i)a[bcd]*dcdcde", "ADCDCDE", Some((0, 7))); mat!(match_python_261, "(?i)(ab|a)b*c", "ABC", Some((0, 3))); mat!(match_python_262, "(?i)((a)(b)c)(d)", "ABCD", Some((0, 4))); mat!(match_python_263, "(?i)[a-zA-Z_][a-zA-Z0-9_]*", "ALPHA", Some((0, 5))); mat!(match_python_264, "(?i)^a(bc+|b[eh])g|.h$", "ABH", Some((1, 3))); mat!(match_python_265, "(?i)(bc+d$|ef*g.|h?i(j|k))", "EFFGZ", Some((0, 5))); mat!(match_python_266, "(?i)(bc+d$|ef*g.|h?i(j|k))", "IJ", Some((0, 2))); mat!(match_python_267, "(?i)(bc+d$|ef*g.|h?i(j|k))", "REFFGZ", Some((1, 6))); mat!(match_python_268, "(?i)((((((((((a))))))))))", "A", Some((0, 1))); mat!(match_python_269, "(?i)(((((((((a)))))))))", "A", Some((0, 1))); mat!(match_python_270, "(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))", "A", Some((0, 1))); mat!(match_python_271, "(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))", "C", Some((0, 1))); mat!(match_python_272, "(?i)multiple words", "MULTIPLE WORDS, YEAH", Some((0, 14))); mat!(match_python_273, "(?i)(.*)c(.*)", "ABCDE", Some((0, 5))); mat!(match_python_274, "(?i)\\((.*), (.*)\\)", "(A, B)", Some((0, 6))); mat!(match_python_275, "(?i)a[-]?c", "AC", Some((0, 2))); mat!(match_python_276, "a(?:b|c|d)(.)", "ace", Some((0, 3))); mat!(match_python_277, "a(?:b|c|d)*(.)", "ace", Some((0, 3))); mat!(match_python_278, "a(?:b|c|d)+?(.)", "ace", Some((0, 3))); mat!(match_python_279, "a(?:b|(c|e){1,2}?|d)+?(.)", "ace", Some((0, 3))); mat!(match_python_280, "^(.+)?B", "AB", Some((0, 2))); mat!(match_python_281, "(?m)^abc", "jkl\nabc\nxyz", Some((4, 7))); mat!(match_python_282, "(?m)abc$", "jkl\nxyzabc\n123", Some((7, 10))); mat!(match_python_283, "(?s)a.b", "a\nb", Some((0, 3))); mat!(match_python_284, "\\w+", "--ab_cd0123--", Some((2, 11))); mat!(match_python_285, "[\\w]+", "--ab_cd0123--", Some((2, 11))); mat!(match_python_286, "\\D+", "1234abc5678", Some((4, 7))); mat!(match_python_287, "[\\D]+", "1234abc5678", Some((4, 7))); mat!(match_python_288, "[\\da-fA-F]+", "123abc", Some((0, 6))); mat!(match_python_289, "([\\s]*)([\\S]*)([\\s]*)", " testing!1972", Some((0, 13))); mat!(match_python_290, "(\\s*)(\\S*)(\\s*)", " testing!1972", Some((0, 13))); mat!(match_python_291, "\\xff", "\u{00ff}", Some((0, 2))); mat!(match_python_292, "\\t\\n\\v\\r\\f\\a", "\t\n\u{000b}\r\u{000c}\u{0007}", Some((0, 6))); mat!(match_python_293, "(([a-z]+):)?([a-z]+)$", "smil", Some((0, 4))); mat!(match_python_294, ".*d", "abc\nabd", Some((4, 7))); mat!(match_python_295, "[\\41]", "!", Some((0, 1))); mat!(match_python_296, "(x?)?", "x", Some((0, 1))); mat!(match_python_297, "(?x) foo ", "foo", Some((0, 3))); mat!(match_python_298, "[\\w-]+", "laser_beam", Some((0, 10))); mat!(match_python_299, ".*?\\S *:", "xx:", Some((0, 3))); mat!(match_python_300, "a[ ]*? (\\d+).*", "a 10", Some((0, 6))); mat!(match_python_301, "a[ ]*? (\\d+).*", "a 10", Some((0, 7))); mat!(match_python_302, "(?ms).*?x\\s*\\z(.*)", "xx\nx\n", Some((0, 5))); mat!(match_python_303, "(?i)M+", "MMM", Some((0, 3))); mat!(match_python_304, "(?i)m+", "MMM", Some((0, 3))); mat!(match_python_305, "(?i)[M]+", "MMM", Some((0, 3))); mat!(match_python_306, "(?i)[m]+", "MMM", Some((0, 3))); mat!(match_python_307, "\"(?:\\\\\"|[^\"])*?\"", "\"\\\"\"", Some((0, 4))); mat!(match_python_308, "^((a)c)?(ab)$", "ab", Some((0, 2))); mat!(match_python_309, "\\b.\\b", "a", Some((0, 1))); mat!(match_python_310, "\\b.\\b", "\u{00c4}", Some((0, 2))); mat!(match_python_311, "\\w", "\u{00c4}", Some((0, 2))); no_mat!(no_match_python_00, "[^a\\0]", "\u{0000}"); no_mat!(no_match_python_01, "\\x00ffffffffffffff", "\u{00ff}"); no_mat!(no_match_python_02, "\\x00f", "\u{000f}"); no_mat!(no_match_python_03, "\\x00fe", "\u{00fe}"); no_mat!(no_match_python_04, "a.b", "a\nb"); no_mat!(no_match_python_05, "a.*b", "acc\nccb"); no_mat!(no_match_python_06, "a.{4,5}b", "acc\nccb"); no_mat!(no_match_python_07, "abc", "xbc"); no_mat!(no_match_python_08, "abc", "axc"); no_mat!(no_match_python_09, "abc", "abx"); no_mat!(no_match_python_10, "ab+bc", "abc"); no_mat!(no_match_python_11, "ab+bc", "abq"); no_mat!(no_match_python_12, "ab?bc", "abbbbc"); no_mat!(no_match_python_13, "^abc$", "abcc"); no_mat!(no_match_python_14, "^abc$", "aabc"); no_mat!(no_match_python_15, "a.*c", "axyzd"); no_mat!(no_match_python_16, "a[bc]d", "abc"); no_mat!(no_match_python_17, "a[b-d]e", "abd"); no_mat!(no_match_python_18, "a[^bc]d", "abd"); no_mat!(no_match_python_19, "a[^-b]c", "a-c"); no_mat!(no_match_python_20, "a[^]b]c", "a]c"); no_mat!(no_match_python_21, "\\by\\b", "xy"); no_mat!(no_match_python_22, "\\by\\b", "yz"); no_mat!(no_match_python_23, "\\by\\b", "xyz"); no_mat!(no_match_python_24, "x\\b", "xyz"); no_mat!(no_match_python_25, "z\\B", "xyz"); no_mat!(no_match_python_26, "\\Bx", "xyz"); no_mat!(no_match_python_27, "\\Ba\\B", "a-"); no_mat!(no_match_python_28, "\\Ba\\B", "-a"); no_mat!(no_match_python_29, "\\Ba\\B", "-a-"); no_mat!(no_match_python_30, "\\By\\B", "xy"); no_mat!(no_match_python_31, "\\By\\B", "yz"); no_mat!(no_match_python_32, "$b", "b"); no_mat!(no_match_python_33, "abc", ""); no_mat!(no_match_python_34, "^(ab|cd)e", "abcde"); no_mat!(no_match_python_35, "a[bcd]+dcdcde", "adcdcde"); no_mat!(no_match_python_36, "(bc+d$|ef*g.|h?i(j|k))", "effg"); no_mat!(no_match_python_37, "(bc+d$|ef*g.|h?i(j|k))", "bcdd"); no_mat!(no_match_python_38, "multiple words of text", "uh-uh"); no_mat!(no_match_python_39, "[k]", "ab"); no_mat!(no_match_python_40, "([abc]*)x", "abc"); no_mat!(no_match_python_41, "abc", "xbc"); no_mat!(no_match_python_42, "abc", "axc"); no_mat!(no_match_python_43, "abc", "abx"); no_mat!(no_match_python_44, "ab+bc", "abc"); no_mat!(no_match_python_45, "ab+bc", "abq"); no_mat!(no_match_python_46, "ab{1,}bc", "abq"); no_mat!(no_match_python_47, "ab{4,5}bc", "abbbbc"); no_mat!(no_match_python_48, "ab?bc", "abbbbc"); no_mat!(no_match_python_49, "^abc$", "abcc"); no_mat!(no_match_python_50, "^abc$", "aabc"); no_mat!(no_match_python_51, "a.*c", "axyzd"); no_mat!(no_match_python_52, "a[bc]d", "abc"); no_mat!(no_match_python_53, "a[b-d]e", "abd"); no_mat!(no_match_python_54, "a[^bc]d", "abd"); no_mat!(no_match_python_55, "a[^-b]c", "a-c"); no_mat!(no_match_python_56, "a[^]b]c", "a]c"); no_mat!(no_match_python_57, "$b", "b"); no_mat!(no_match_python_58, "abc", ""); no_mat!(no_match_python_59, "^(ab|cd)e", "abcde"); no_mat!(no_match_python_60, "a[bcd]+dcdcde", "adcdcde"); no_mat!(no_match_python_61, "(bc+d$|ef*g.|h?i(j|k))", "effg"); no_mat!(no_match_python_62, "(bc+d$|ef*g.|h?i(j|k))", "bcdd"); no_mat!(no_match_python_63, "multiple words of text", "uh-uh"); no_mat!(no_match_python_64, "[k]", "ab"); no_mat!(no_match_python_65, "(?i)abc", "XBC"); no_mat!(no_match_python_66, "(?i)abc", "AXC"); no_mat!(no_match_python_67, "(?i)abc", "ABX"); no_mat!(no_match_python_68, "(?i)ab+bc", "ABC"); no_mat!(no_match_python_69, "(?i)ab+bc", "ABQ"); no_mat!(no_match_python_70, "(?i)ab{1,}bc", "ABQ"); no_mat!(no_match_python_71, "(?i)ab{4,5}?bc", "ABBBBC"); no_mat!(no_match_python_72, "(?i)ab??bc", "ABBBBC"); no_mat!(no_match_python_73, "(?i)^abc$", "ABCC"); no_mat!(no_match_python_74, "(?i)^abc$", "AABC"); no_mat!(no_match_python_75, "(?i)a.*c", "AXYZD"); no_mat!(no_match_python_76, "(?i)a[bc]d", "ABC"); no_mat!(no_match_python_77, "(?i)a[b-d]e", "ABD"); no_mat!(no_match_python_78, "(?i)a[^bc]d", "ABD"); no_mat!(no_match_python_79, "(?i)a[^-b]c", "A-C"); no_mat!(no_match_python_80, "(?i)a[^]b]c", "A]C"); no_mat!(no_match_python_81, "(?i)$b", "B"); no_mat!(no_match_python_82, "(?i)abc", ""); no_mat!(no_match_python_83, "(?i)^(ab|cd)e", "ABCDE"); no_mat!(no_match_python_84, "(?i)a[bcd]+dcdcde", "ADCDCDE"); no_mat!(no_match_python_85, "(?i)(bc+d$|ef*g.|h?i(j|k))", "EFFG"); no_mat!(no_match_python_86, "(?i)(bc+d$|ef*g.|h?i(j|k))", "BCDD"); no_mat!(no_match_python_87, "(?i)multiple words of text", "UH-UH"); no_mat!(no_match_python_88, "(?i)[k]", "AB"); no_mat!(no_match_python_89, "^abc", "jkl\nabc\nxyz"); no_mat!(no_match_python_90, "a.b", "a\nb"); no_mat!(no_match_python_91, "\\x00ff", "\u{00ff}"); no_mat!(no_match_python_92, "^.*?$", "one\ntwo\nthree\n"); no_mat!(no_match_python_93, "a[^>]*?b", "a>b"); no_mat!(no_match_python_94, "^a*?$", "foo"); // Test various configurations that have prefixes which match, but the actual match is later. mat!(match_skip_1, "a[^b]", "abababac", Some((6, 8))); mat!(match_skip_2, "abc[^d]", "yzabcdyzabcz", Some((8, 12))); mat!(match_skip_3, "(aa|bb)[^c]", "aacbbcaaa", Some((6, 9)));