| 1 | [[test]] |
| 2 | name = "nothing-empty" |
| 3 | regex = [] |
| 4 | haystack = "" |
| 5 | matches = [] |
| 6 | |
| 7 | [[test]] |
| 8 | name = "nothing-something" |
| 9 | regex = [] |
| 10 | haystack = "wat" |
| 11 | matches = [] |
| 12 | |
| 13 | [[test]] |
| 14 | name = "ranges" |
| 15 | regex = '(?-u)\b(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b' |
| 16 | haystack = "num: 255" |
| 17 | matches = [[5, 8]] |
| 18 | |
| 19 | [[test]] |
| 20 | name = "ranges-not" |
| 21 | regex = '(?-u)\b(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b' |
| 22 | haystack = "num: 256" |
| 23 | matches = [] |
| 24 | |
| 25 | [[test]] |
| 26 | name = "float1" |
| 27 | regex = '[-+]?[0-9]*\.?[0-9]+' |
| 28 | haystack = "0.1" |
| 29 | matches = [[0, 3]] |
| 30 | |
| 31 | [[test]] |
| 32 | name = "float2" |
| 33 | regex = '[-+]?[0-9]*\.?[0-9]+' |
| 34 | haystack = "0.1.2" |
| 35 | matches = [[0, 3]] |
| 36 | match-limit = 1 |
| 37 | |
| 38 | [[test]] |
| 39 | name = "float3" |
| 40 | regex = '[-+]?[0-9]*\.?[0-9]+' |
| 41 | haystack = "a1.2" |
| 42 | matches = [[1, 4]] |
| 43 | |
| 44 | [[test]] |
| 45 | name = "float4" |
| 46 | regex = '[-+]?[0-9]*\.?[0-9]+' |
| 47 | haystack = "1.a" |
| 48 | matches = [[0, 1]] |
| 49 | |
| 50 | [[test]] |
| 51 | name = "float5" |
| 52 | regex = '^[-+]?[0-9]*\.?[0-9]+$' |
| 53 | haystack = "1.a" |
| 54 | matches = [] |
| 55 | |
| 56 | [[test]] |
| 57 | name = "email" |
| 58 | regex = '(?i-u)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b' |
| 59 | haystack = "mine is [email protected] " |
| 60 | matches = [[8, 26]] |
| 61 | |
| 62 | [[test]] |
| 63 | name = "email-not" |
| 64 | regex = '(?i-u)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b' |
| 65 | haystack = "mine is jam.slam@gmail " |
| 66 | matches = [] |
| 67 | |
| 68 | [[test]] |
| 69 | name = "email-big" |
| 70 | 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])?''' |
| 71 | haystack = "mine is [email protected] " |
| 72 | matches = [[8, 26]] |
| 73 | |
| 74 | [[test]] |
| 75 | name = "date1" |
| 76 | regex = '^(?:19|20)\d\d[- /.](?:0[1-9]|1[012])[- /.](?:0[1-9]|[12][0-9]|3[01])$' |
| 77 | haystack = "1900-01-01" |
| 78 | matches = [[0, 10]] |
| 79 | unicode = false |
| 80 | |
| 81 | [[test]] |
| 82 | name = "date2" |
| 83 | regex = '^(?:19|20)\d\d[- /.](?:0[1-9]|1[012])[- /.](?:0[1-9]|[12][0-9]|3[01])$' |
| 84 | haystack = "1900-00-01" |
| 85 | matches = [] |
| 86 | unicode = false |
| 87 | |
| 88 | [[test]] |
| 89 | name = "date3" |
| 90 | regex = '^(?:19|20)\d\d[- /.](?:0[1-9]|1[012])[- /.](?:0[1-9]|[12][0-9]|3[01])$' |
| 91 | haystack = "1900-13-01" |
| 92 | matches = [] |
| 93 | unicode = false |
| 94 | |
| 95 | [[test]] |
| 96 | name = "start-end-empty" |
| 97 | regex = '^$' |
| 98 | haystack = "" |
| 99 | matches = [[0, 0]] |
| 100 | |
| 101 | [[test]] |
| 102 | name = "start-end-empty-rev" |
| 103 | regex = '$^' |
| 104 | haystack = "" |
| 105 | matches = [[0, 0]] |
| 106 | |
| 107 | [[test]] |
| 108 | name = "start-end-empty-many-1" |
| 109 | regex = '^$^$^$' |
| 110 | haystack = "" |
| 111 | matches = [[0, 0]] |
| 112 | |
| 113 | [[test]] |
| 114 | name = "start-end-empty-many-2" |
| 115 | regex = '^^^$$$' |
| 116 | haystack = "" |
| 117 | matches = [[0, 0]] |
| 118 | |
| 119 | [[test]] |
| 120 | name = "start-end-empty-rep" |
| 121 | regex = '(?:^$)*' |
| 122 | haystack = "a\nb\nc" |
| 123 | matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]] |
| 124 | |
| 125 | [[test]] |
| 126 | name = "start-end-empty-rep-rev" |
| 127 | regex = '(?:$^)*' |
| 128 | haystack = "a\nb\nc" |
| 129 | matches = [[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]] |
| 130 | |
| 131 | [[test]] |
| 132 | name = "neg-class-letter" |
| 133 | regex = '[^ac]' |
| 134 | haystack = "acx" |
| 135 | matches = [[2, 3]] |
| 136 | |
| 137 | [[test]] |
| 138 | name = "neg-class-letter-comma" |
| 139 | regex = '[^a,]' |
| 140 | haystack = "a,x" |
| 141 | matches = [[2, 3]] |
| 142 | |
| 143 | [[test]] |
| 144 | name = "neg-class-letter-space" |
| 145 | regex = '[^a[:space:]]' |
| 146 | haystack = "a x" |
| 147 | matches = [[2, 3]] |
| 148 | |
| 149 | [[test]] |
| 150 | name = "neg-class-comma" |
| 151 | regex = '[^,]' |
| 152 | haystack = ",,x" |
| 153 | matches = [[2, 3]] |
| 154 | |
| 155 | [[test]] |
| 156 | name = "neg-class-space" |
| 157 | regex = '[^[:space:]]' |
| 158 | haystack = " a" |
| 159 | matches = [[1, 2]] |
| 160 | |
| 161 | [[test]] |
| 162 | name = "neg-class-space-comma" |
| 163 | regex = '[^,[:space:]]' |
| 164 | haystack = ", a" |
| 165 | matches = [[2, 3]] |
| 166 | |
| 167 | [[test]] |
| 168 | name = "neg-class-comma-space" |
| 169 | regex = '[^[:space:],]' |
| 170 | haystack = " ,a" |
| 171 | matches = [[2, 3]] |
| 172 | |
| 173 | [[test]] |
| 174 | name = "neg-class-ascii" |
| 175 | regex = '[^[:alpha:]Z]' |
| 176 | haystack = "A1" |
| 177 | matches = [[1, 2]] |
| 178 | |
| 179 | [[test]] |
| 180 | name = "lazy-many-many" |
| 181 | regex = '(?:(?:.*)*?)=' |
| 182 | haystack = "a=b" |
| 183 | matches = [[0, 2]] |
| 184 | |
| 185 | [[test]] |
| 186 | name = "lazy-many-optional" |
| 187 | regex = '(?:(?:.?)*?)=' |
| 188 | haystack = "a=b" |
| 189 | matches = [[0, 2]] |
| 190 | |
| 191 | [[test]] |
| 192 | name = "lazy-one-many-many" |
| 193 | regex = '(?:(?:.*)+?)=' |
| 194 | haystack = "a=b" |
| 195 | matches = [[0, 2]] |
| 196 | |
| 197 | [[test]] |
| 198 | name = "lazy-one-many-optional" |
| 199 | regex = '(?:(?:.?)+?)=' |
| 200 | haystack = "a=b" |
| 201 | matches = [[0, 2]] |
| 202 | |
| 203 | [[test]] |
| 204 | name = "lazy-range-min-many" |
| 205 | regex = '(?:(?:.*){1,}?)=' |
| 206 | haystack = "a=b" |
| 207 | matches = [[0, 2]] |
| 208 | |
| 209 | [[test]] |
| 210 | name = "lazy-range-many" |
| 211 | regex = '(?:(?:.*){1,2}?)=' |
| 212 | haystack = "a=b" |
| 213 | matches = [[0, 2]] |
| 214 | |
| 215 | [[test]] |
| 216 | name = "greedy-many-many" |
| 217 | regex = '(?:(?:.*)*)=' |
| 218 | haystack = "a=b" |
| 219 | matches = [[0, 2]] |
| 220 | |
| 221 | [[test]] |
| 222 | name = "greedy-many-optional" |
| 223 | regex = '(?:(?:.?)*)=' |
| 224 | haystack = "a=b" |
| 225 | matches = [[0, 2]] |
| 226 | |
| 227 | [[test]] |
| 228 | name = "greedy-one-many-many" |
| 229 | regex = '(?:(?:.*)+)=' |
| 230 | haystack = "a=b" |
| 231 | matches = [[0, 2]] |
| 232 | |
| 233 | [[test]] |
| 234 | name = "greedy-one-many-optional" |
| 235 | regex = '(?:(?:.?)+)=' |
| 236 | haystack = "a=b" |
| 237 | matches = [[0, 2]] |
| 238 | |
| 239 | [[test]] |
| 240 | name = "greedy-range-min-many" |
| 241 | regex = '(?:(?:.*){1,})=' |
| 242 | haystack = "a=b" |
| 243 | matches = [[0, 2]] |
| 244 | |
| 245 | [[test]] |
| 246 | name = "greedy-range-many" |
| 247 | regex = '(?:(?:.*){1,2})=' |
| 248 | haystack = "a=b" |
| 249 | matches = [[0, 2]] |
| 250 | |
| 251 | [[test]] |
| 252 | name = "empty1" |
| 253 | regex = '' |
| 254 | haystack = "" |
| 255 | matches = [[0, 0]] |
| 256 | |
| 257 | [[test]] |
| 258 | name = "empty2" |
| 259 | regex = '' |
| 260 | haystack = "abc" |
| 261 | matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| 262 | |
| 263 | [[test]] |
| 264 | name = "empty3" |
| 265 | regex = '(?:)' |
| 266 | haystack = "abc" |
| 267 | matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| 268 | |
| 269 | [[test]] |
| 270 | name = "empty4" |
| 271 | regex = '(?:)*' |
| 272 | haystack = "abc" |
| 273 | matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| 274 | |
| 275 | [[test]] |
| 276 | name = "empty5" |
| 277 | regex = '(?:)+' |
| 278 | haystack = "abc" |
| 279 | matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| 280 | |
| 281 | [[test]] |
| 282 | name = "empty6" |
| 283 | regex = '(?:)?' |
| 284 | haystack = "abc" |
| 285 | matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| 286 | |
| 287 | [[test]] |
| 288 | name = "empty7" |
| 289 | regex = '(?:)(?:)' |
| 290 | haystack = "abc" |
| 291 | matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| 292 | |
| 293 | [[test]] |
| 294 | name = "empty8" |
| 295 | regex = '(?:)+|z' |
| 296 | haystack = "abc" |
| 297 | matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| 298 | |
| 299 | [[test]] |
| 300 | name = "empty9" |
| 301 | regex = 'z|(?:)+' |
| 302 | haystack = "abc" |
| 303 | matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| 304 | |
| 305 | [[test]] |
| 306 | name = "empty10" |
| 307 | regex = '(?:)+|b' |
| 308 | haystack = "abc" |
| 309 | matches = [[0, 0], [1, 1], [2, 2], [3, 3]] |
| 310 | |
| 311 | [[test]] |
| 312 | name = "empty11" |
| 313 | regex = 'b|(?:)+' |
| 314 | haystack = "abc" |
| 315 | matches = [[0, 0], [1, 2], [3, 3]] |