| # TODO: There are still a couple of manually written tests in crazy.rs. |
| |
| [[tests]] |
| name = "ranges" |
| regex = '(?-u)\b(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b' |
| input = "num: 255" |
| matches = [[5, 8]] |
| |
| [[tests]] |
| name = "ranges-not" |
| regex = '(?-u)\b(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b' |
| input = "num: 256" |
| matches = [] |
| |
| [[tests]] |
| name = "float1" |
| regex = '[-+]?[0-9]*\.?[0-9]+' |
| input = "0.1" |
| matches = [[0, 3]] |
| |
| [[tests]] |
| name = "float2" |
| regex = '[-+]?[0-9]*\.?[0-9]+' |
| input = "0.1.2" |
| matches = [[0, 3]] |
| match_limit = 1 |
| |
| [[tests]] |
| name = "float3" |
| regex = '[-+]?[0-9]*\.?[0-9]+' |
| input = "a1.2" |
| matches = [[1, 4]] |
| |
| [[tests]] |
| name = "float4" |
| regex = '[-+]?[0-9]*\.?[0-9]+' |
| input = "1.a" |
| matches = [[0, 1]] |
| |
| [[tests]] |
| name = "float5" |
| regex = '^[-+]?[0-9]*\.?[0-9]+$' |
| input = "1.a" |
| matches = [] |
| |
| [[tests]] |
| name = "email" |
| regex = '(?i-u)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b' |
| input = "mine is jam.slam@gmail.com " |
| matches = [[8, 26]] |
| |
| [[tests]] |
| name = "email-not" |
| regex = '(?i-u)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b' |
| input = "mine is jam.slam@gmail " |
| matches = [] |
| |
| [[tests]] |
| name = "email-big" |
| regex = '''[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?''' |
| input = "mine is jam.slam@gmail.com " |
| matches = [[8, 26]] |
| |
| [[tests]] |
| name = "date1" |
| regex = '(?-u)^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$' |
| input = "1900-01-01" |
| matches = [[0, 10]] |
| |
| [[tests]] |
| name = "date2" |
| regex = '(?-u)^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$' |
| input = "1900-00-01" |
| matches = [] |
| |
| [[tests]] |
| name = "date3" |
| regex = '(?-u)^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$' |
| input = "1900-13-01" |
| matches = [] |
| |
| [[tests]] |
| name = "start-end-empty" |
| regex = '^$' |
| input = "" |
| matches = [[0, 0]] |
| |
| [[tests]] |
| name = "start-end-empty-rev" |
| regex = '$^' |
| input = "" |
| matches = [[0, 0]] |
| |
| [[tests]] |
| name = "start-end-empty-many-1" |
| regex = '^$^$^$' |
| input = "" |
| matches = [[0, 0]] |
| |
| [[tests]] |
| name = "start-end-empty-many-2" |
| regex = '^^^$$$' |
| input = "" |
| matches = [[0, 0]] |
| |
| [[tests]] |
| name = "start-end-empty-rep" |
| regex = '(?:^$)*' |
| input = "a\nb\nc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]] |
| |
| [[tests]] |
| name = "start-end-empty-rep-rev" |
| regex = '(?:$^)*' |
| input = "a\nb\nc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]] |
| |
| [[tests]] |
| name = "neg-class-letter" |
| regex = '[^ac]' |
| input = "acx" |
| matches = [[2, 3]] |
| |
| [[tests]] |
| name = "neg-class-letter-comma" |
| regex = '[^a,]' |
| input = "a,x" |
| matches = [[2, 3]] |
| |
| [[tests]] |
| name = "neg-class-letter-space" |
| regex = '[^a[:space:]]' |
| input = "a x" |
| matches = [[2, 3]] |
| |
| [[tests]] |
| name = "neg-class-comma" |
| regex = '[^,]' |
| input = ",,x" |
| matches = [[2, 3]] |
| |
| [[tests]] |
| name = "neg-class-space" |
| regex = '[^[:space:]]' |
| input = " a" |
| matches = [[1, 2]] |
| |
| [[tests]] |
| name = "neg-class-space-comma" |
| regex = '[^,[:space:]]' |
| input = ", a" |
| matches = [[2, 3]] |
| |
| [[tests]] |
| name = "neg-class-comma-space" |
| regex = '[^[:space:],]' |
| input = " ,a" |
| matches = [[2, 3]] |
| |
| [[tests]] |
| name = "neg-class-ascii" |
| regex = '[^[:alpha:]Z]' |
| input = "A1" |
| matches = [[1, 2]] |
| |
| [[tests]] |
| name = "lazy-many-many" |
| regex = '((?:.*)*?)=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "lazy-many-optional" |
| regex = '((?:.?)*?)=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "lazy-one-many-many" |
| regex = '((?:.*)+?)=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "lazy-one-many-optional" |
| regex = '((?:.?)+?)=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "lazy-range-min-many" |
| regex = '((?:.*){1,}?)=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "lazy-range-many" |
| regex = '((?:.*){1,2}?)=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "greedy-many-many" |
| regex = '((?:.*)*)=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "greedy-many-optional" |
| regex = '((?:.?)*)=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "greedy-one-many-many" |
| regex = '((?:.*)+)=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "greedy-one-many-optional" |
| regex = '((?:.?)+)=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "greedy-range-min-many" |
| regex = '((?:.*){1,})=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "greedy-range-many" |
| regex = '((?:.*){1,2})=' |
| input = "a=b" |
| matches = [[0, 2]] |
| |
| [[tests]] |
| name = "empty1" |
| regex = '' |
| input = "" |
| matches = [[0, 0]] |
| |
| [[tests]] |
| name = "empty2" |
| regex = '' |
| input = "abc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| |
| [[tests]] |
| name = "empty3" |
| regex = '()' |
| input = "abc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| |
| [[tests]] |
| name = "empty4" |
| regex = '()*' |
| input = "abc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| |
| [[tests]] |
| name = "empty5" |
| regex = '()+' |
| input = "abc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| |
| [[tests]] |
| name = "empty6" |
| regex = '()?' |
| input = "abc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| |
| [[tests]] |
| name = "empty7" |
| regex = '()()' |
| input = "abc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| |
| [[tests]] |
| name = "empty8" |
| regex = '()+|z' |
| input = "abc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| |
| [[tests]] |
| name = "empty9" |
| regex = 'z|()+' |
| input = "abc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| |
| [[tests]] |
| name = "empty10" |
| regex = '()+|b' |
| input = "abc" |
| matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| |
| [[tests]] |
| name = "empty11" |
| regex = 'b|()+' |
| input = "abc" |
| matches = [[0, 0], [1, 2], [3, 3]] |