| 1 |
# Basic Unicode literal support. |
| 2 |
[[test]] |
| 3 |
name = "literal1" |
| 4 |
regex = '☃' |
| 5 |
haystack = "☃" |
| 6 |
matches = [[0, 3]] |
| 7 |
|
| 8 |
[[test]] |
| 9 |
name = "literal2" |
| 10 |
regex = '☃+' |
| 11 |
haystack = "☃" |
| 12 |
matches = [[0, 3]] |
| 13 |
|
| 14 |
[[test]] |
| 15 |
name = "literal3" |
| 16 |
regex = '☃+' |
| 17 |
haystack = "☃" |
| 18 |
matches = [[0, 3]] |
| 19 |
case-insensitive = true |
| 20 |
|
| 21 |
[[test]] |
| 22 |
name = "literal4" |
| 23 |
regex = 'Δ' |
| 24 |
haystack = "δ" |
| 25 |
matches = [[0, 2]] |
| 26 |
case-insensitive = true |
| 27 |
|
| 28 |
# Unicode word boundaries. |
| 29 |
[[test]] |
| 30 |
name = "wb-100" |
| 31 |
regex = '\d\b' |
| 32 |
haystack = "6δ" |
| 33 |
matches = [] |
| 34 |
|
| 35 |
[[test]] |
| 36 |
name = "wb-200" |
| 37 |
regex = '\d\b' |
| 38 |
haystack = "6 " |
| 39 |
matches = [[0, 1]] |
| 40 |
|
| 41 |
[[test]] |
| 42 |
name = "wb-300" |
| 43 |
regex = '\d\B' |
| 44 |
haystack = "6δ" |
| 45 |
matches = [[0, 1]] |
| 46 |
|
| 47 |
[[test]] |
| 48 |
name = "wb-400" |
| 49 |
regex = '\d\B' |
| 50 |
haystack = "6 " |
| 51 |
matches = [] |
| 52 |
|
| 53 |
# Unicode character class support. |
| 54 |
[[test]] |
| 55 |
name = "class1" |
| 56 |
regex = '[☃Ⅰ]+' |
| 57 |
haystack = "☃" |
| 58 |
matches = [[0, 3]] |
| 59 |
|
| 60 |
[[test]] |
| 61 |
name = "class2" |
| 62 |
regex = '\pN' |
| 63 |
haystack = "Ⅰ" |
| 64 |
matches = [[0, 3]] |
| 65 |
|
| 66 |
[[test]] |
| 67 |
name = "class3" |
| 68 |
regex = '\pN+' |
| 69 |
haystack = "Ⅰ1Ⅱ2" |
| 70 |
matches = [[0, 8]] |
| 71 |
|
| 72 |
[[test]] |
| 73 |
name = "class4" |
| 74 |
regex = '\PN+' |
| 75 |
haystack = "abⅠ" |
| 76 |
matches = [[0, 2]] |
| 77 |
|
| 78 |
[[test]] |
| 79 |
name = "class5" |
| 80 |
regex = '[\PN]+' |
| 81 |
haystack = "abⅠ" |
| 82 |
matches = [[0, 2]] |
| 83 |
|
| 84 |
[[test]] |
| 85 |
name = "class6" |
| 86 |
regex = '[^\PN]+' |
| 87 |
haystack = "abⅠ" |
| 88 |
matches = [[2, 5]] |
| 89 |
|
| 90 |
[[test]] |
| 91 |
name = "class7" |
| 92 |
regex = '\p{Lu}+' |
| 93 |
haystack = "ΛΘΓΔα" |
| 94 |
matches = [[0, 8]] |
| 95 |
|
| 96 |
[[test]] |
| 97 |
name = "class8" |
| 98 |
regex = '\p{Lu}+' |
| 99 |
haystack = "ΛΘΓΔα" |
| 100 |
matches = [[0, 10]] |
| 101 |
case-insensitive = true |
| 102 |
|
| 103 |
[[test]] |
| 104 |
name = "class9" |
| 105 |
regex = '\pL+' |
| 106 |
haystack = "ΛΘΓΔα" |
| 107 |
matches = [[0, 10]] |
| 108 |
|
| 109 |
[[test]] |
| 110 |
name = "class10" |
| 111 |
regex = '\p{Ll}+' |
| 112 |
haystack = "ΛΘΓΔα" |
| 113 |
matches = [[8, 10]] |
| 114 |
|
| 115 |
# Unicode aware "Perl" character classes. |
| 116 |
[[test]] |
| 117 |
name = "perl1" |
| 118 |
regex = '\w+' |
| 119 |
haystack = "dδd" |
| 120 |
matches = [[0, 4]] |
| 121 |
|
| 122 |
[[test]] |
| 123 |
name = "perl2" |
| 124 |
regex = '\w+' |
| 125 |
haystack = "⥡" |
| 126 |
matches = [] |
| 127 |
|
| 128 |
[[test]] |
| 129 |
name = "perl3" |
| 130 |
regex = '\W+' |
| 131 |
haystack = "⥡" |
| 132 |
matches = [[0, 3]] |
| 133 |
|
| 134 |
[[test]] |
| 135 |
name = "perl4" |
| 136 |
regex = '\d+' |
| 137 |
haystack = "1२३9" |
| 138 |
matches = [[0, 8]] |
| 139 |
|
| 140 |
[[test]] |
| 141 |
name = "perl5" |
| 142 |
regex = '\d+' |
| 143 |
haystack = "Ⅱ" |
| 144 |
matches = [] |
| 145 |
|
| 146 |
[[test]] |
| 147 |
name = "perl6" |
| 148 |
regex = '\D+' |
| 149 |
haystack = "Ⅱ" |
| 150 |
matches = [[0, 3]] |
| 151 |
|
| 152 |
[[test]] |
| 153 |
name = "perl7" |
| 154 |
regex = '\s+' |
| 155 |
haystack = " " |
| 156 |
matches = [[0, 3]] |
| 157 |
|
| 158 |
[[test]] |
| 159 |
name = "perl8" |
| 160 |
regex = '\s+' |
| 161 |
haystack = "☃" |
| 162 |
matches = [] |
| 163 |
|
| 164 |
[[test]] |
| 165 |
name = "perl9" |
| 166 |
regex = '\S+' |
| 167 |
haystack = "☃" |
| 168 |
matches = [[0, 3]] |
| 169 |
|
| 170 |
# Specific tests for Unicode general category classes. |
| 171 |
[[test]] |
| 172 |
name = "class-gencat1" |
| 173 |
regex = '\p{Cased_Letter}' |
| 174 |
haystack = "A" |
| 175 |
matches = [[0, 3]] |
| 176 |
|
| 177 |
[[test]] |
| 178 |
name = "class-gencat2" |
| 179 |
regex = '\p{Close_Punctuation}' |
| 180 |
haystack = "❯" |
| 181 |
matches = [[0, 3]] |
| 182 |
|
| 183 |
[[test]] |
| 184 |
name = "class-gencat3" |
| 185 |
regex = '\p{Connector_Punctuation}' |
| 186 |
haystack = "⁀" |
| 187 |
matches = [[0, 3]] |
| 188 |
|
| 189 |
[[test]] |
| 190 |
name = "class-gencat4" |
| 191 |
regex = '\p{Control}' |
| 192 |
haystack = "\u009F" |
| 193 |
matches = [[0, 2]] |
| 194 |
|
| 195 |
[[test]] |
| 196 |
name = "class-gencat5" |
| 197 |
regex = '\p{Currency_Symbol}' |
| 198 |
haystack = "£" |
| 199 |
matches = [[0, 3]] |
| 200 |
|
| 201 |
[[test]] |
| 202 |
name = "class-gencat6" |
| 203 |
regex = '\p{Dash_Punctuation}' |
| 204 |
haystack = "〰" |
| 205 |
matches = [[0, 3]] |
| 206 |
|
| 207 |
[[test]] |
| 208 |
name = "class-gencat7" |
| 209 |
regex = '\p{Decimal_Number}' |
| 210 |
haystack = "𑓙" |
| 211 |
matches = [[0, 4]] |
| 212 |
|
| 213 |
[[test]] |
| 214 |
name = "class-gencat8" |
| 215 |
regex = '\p{Enclosing_Mark}' |
| 216 |
haystack = "\uA672" |
| 217 |
matches = [[0, 3]] |
| 218 |
|
| 219 |
[[test]] |
| 220 |
name = "class-gencat9" |
| 221 |
regex = '\p{Final_Punctuation}' |
| 222 |
haystack = "⸡" |
| 223 |
matches = [[0, 3]] |
| 224 |
|
| 225 |
[[test]] |
| 226 |
name = "class-gencat10" |
| 227 |
regex = '\p{Format}' |
| 228 |
haystack = "\U000E007F" |
| 229 |
matches = [[0, 4]] |
| 230 |
|
| 231 |
[[test]] |
| 232 |
name = "class-gencat11" |
| 233 |
regex = '\p{Initial_Punctuation}' |
| 234 |
haystack = "⸜" |
| 235 |
matches = [[0, 3]] |
| 236 |
|
| 237 |
[[test]] |
| 238 |
name = "class-gencat12" |
| 239 |
regex = '\p{Letter}' |
| 240 |
haystack = "Έ" |
| 241 |
matches = [[0, 2]] |
| 242 |
|
| 243 |
[[test]] |
| 244 |
name = "class-gencat13" |
| 245 |
regex = '\p{Letter_Number}' |
| 246 |
haystack = "ↂ" |
| 247 |
matches = [[0, 3]] |
| 248 |
|
| 249 |
[[test]] |
| 250 |
name = "class-gencat14" |
| 251 |
regex = '\p{Line_Separator}' |
| 252 |
haystack = "\u2028" |
| 253 |
matches = [[0, 3]] |
| 254 |
|
| 255 |
[[test]] |
| 256 |
name = "class-gencat15" |
| 257 |
regex = '\p{Lowercase_Letter}' |
| 258 |
haystack = "ϛ" |
| 259 |
matches = [[0, 2]] |
| 260 |
|
| 261 |
[[test]] |
| 262 |
name = "class-gencat16" |
| 263 |
regex = '\p{Mark}' |
| 264 |
haystack = "\U000E01EF" |
| 265 |
matches = [[0, 4]] |
| 266 |
|
| 267 |
[[test]] |
| 268 |
name = "class-gencat17" |
| 269 |
regex = '\p{Math}' |
| 270 |
haystack = "⋿" |
| 271 |
matches = [[0, 3]] |
| 272 |
|
| 273 |
[[test]] |
| 274 |
name = "class-gencat18" |
| 275 |
regex = '\p{Modifier_Letter}' |
| 276 |
haystack = "𖭃" |
| 277 |
matches = [[0, 4]] |
| 278 |
|
| 279 |
[[test]] |
| 280 |
name = "class-gencat19" |
| 281 |
regex = '\p{Modifier_Symbol}' |
| 282 |
haystack = "🏿" |
| 283 |
matches = [[0, 4]] |
| 284 |
|
| 285 |
[[test]] |
| 286 |
name = "class-gencat20" |
| 287 |
regex = '\p{Nonspacing_Mark}' |
| 288 |
haystack = "\U0001E94A" |
| 289 |
matches = [[0, 4]] |
| 290 |
|
| 291 |
[[test]] |
| 292 |
name = "class-gencat21" |
| 293 |
regex = '\p{Number}' |
| 294 |
haystack = "⓿" |
| 295 |
matches = [[0, 3]] |
| 296 |
|
| 297 |
[[test]] |
| 298 |
name = "class-gencat22" |
| 299 |
regex = '\p{Open_Punctuation}' |
| 300 |
haystack = "⦅" |
| 301 |
matches = [[0, 3]] |
| 302 |
|
| 303 |
[[test]] |
| 304 |
name = "class-gencat23" |
| 305 |
regex = '\p{Other}' |
| 306 |
haystack = "\u0BC9" |
| 307 |
matches = [[0, 3]] |
| 308 |
|
| 309 |
[[test]] |
| 310 |
name = "class-gencat24" |
| 311 |
regex = '\p{Other_Letter}' |
| 312 |
haystack = "ꓷ" |
| 313 |
matches = [[0, 3]] |
| 314 |
|
| 315 |
[[test]] |
| 316 |
name = "class-gencat25" |
| 317 |
regex = '\p{Other_Number}' |
| 318 |
haystack = "㉏" |
| 319 |
matches = [[0, 3]] |
| 320 |
|
| 321 |
[[test]] |
| 322 |
name = "class-gencat26" |
| 323 |
regex = '\p{Other_Punctuation}' |
| 324 |
haystack = "𞥞" |
| 325 |
matches = [[0, 4]] |
| 326 |
|
| 327 |
[[test]] |
| 328 |
name = "class-gencat27" |
| 329 |
regex = '\p{Other_Symbol}' |
| 330 |
haystack = "⅌" |
| 331 |
matches = [[0, 3]] |
| 332 |
|
| 333 |
[[test]] |
| 334 |
name = "class-gencat28" |
| 335 |
regex = '\p{Paragraph_Separator}' |
| 336 |
haystack = "\u2029" |
| 337 |
matches = [[0, 3]] |
| 338 |
|
| 339 |
[[test]] |
| 340 |
name = "class-gencat29" |
| 341 |
regex = '\p{Private_Use}' |
| 342 |
haystack = "\U0010FFFD" |
| 343 |
matches = [[0, 4]] |
| 344 |
|
| 345 |
[[test]] |
| 346 |
name = "class-gencat30" |
| 347 |
regex = '\p{Punctuation}' |
| 348 |
haystack = "𑁍" |
| 349 |
matches = [[0, 4]] |
| 350 |
|
| 351 |
[[test]] |
| 352 |
name = "class-gencat31" |
| 353 |
regex = '\p{Separator}' |
| 354 |
haystack = "\u3000" |
| 355 |
matches = [[0, 3]] |
| 356 |
|
| 357 |
[[test]] |
| 358 |
name = "class-gencat32" |
| 359 |
regex = '\p{Space_Separator}' |
| 360 |
haystack = "\u205F" |
| 361 |
matches = [[0, 3]] |
| 362 |
|
| 363 |
[[test]] |
| 364 |
name = "class-gencat33" |
| 365 |
regex = '\p{Spacing_Mark}' |
| 366 |
haystack = "\U00016F7E" |
| 367 |
matches = [[0, 4]] |
| 368 |
|
| 369 |
[[test]] |
| 370 |
name = "class-gencat34" |
| 371 |
regex = '\p{Symbol}' |
| 372 |
haystack = "⯈" |
| 373 |
matches = [[0, 3]] |
| 374 |
|
| 375 |
[[test]] |
| 376 |
name = "class-gencat35" |
| 377 |
regex = '\p{Titlecase_Letter}' |
| 378 |
haystack = "ῼ" |
| 379 |
matches = [[0, 3]] |
| 380 |
|
| 381 |
[[test]] |
| 382 |
name = "class-gencat36" |
| 383 |
regex = '\p{Unassigned}' |
| 384 |
haystack = "\U0010FFFF" |
| 385 |
matches = [[0, 4]] |
| 386 |
|
| 387 |
[[test]] |
| 388 |
name = "class-gencat37" |
| 389 |
regex = '\p{Uppercase_Letter}' |
| 390 |
haystack = "Ꝋ" |
| 391 |
matches = [[0, 3]] |
| 392 |
|
| 393 |
|
| 394 |
# Tests for Unicode emoji properties. |
| 395 |
[[test]] |
| 396 |
name = "class-emoji1" |
| 397 |
regex = '\p{Emoji}' |
| 398 |
haystack = "\u23E9" |
| 399 |
matches = [[0, 3]] |
| 400 |
|
| 401 |
[[test]] |
| 402 |
name = "class-emoji2" |
| 403 |
regex = '\p{emoji}' |
| 404 |
haystack = "\U0001F21A" |
| 405 |
matches = [[0, 4]] |
| 406 |
|
| 407 |
[[test]] |
| 408 |
name = "class-emoji3" |
| 409 |
regex = '\p{extendedpictographic}' |
| 410 |
haystack = "\U0001FA6E" |
| 411 |
matches = [[0, 4]] |
| 412 |
|
| 413 |
[[test]] |
| 414 |
name = "class-emoji4" |
| 415 |
regex = '\p{extendedpictographic}' |
| 416 |
haystack = "\U0001FFFD" |
| 417 |
matches = [[0, 4]] |
| 418 |
|
| 419 |
|
| 420 |
# Tests for Unicode grapheme cluster properties. |
| 421 |
[[test]] |
| 422 |
name = "class-gcb1" |
| 423 |
regex = '\p{grapheme_cluster_break=prepend}' |
| 424 |
haystack = "\U00011D46" |
| 425 |
matches = [[0, 4]] |
| 426 |
|
| 427 |
[[test]] |
| 428 |
name = "class-gcb2" |
| 429 |
regex = '\p{gcb=regional_indicator}' |
| 430 |
haystack = "\U0001F1E6" |
| 431 |
matches = [[0, 4]] |
| 432 |
|
| 433 |
[[test]] |
| 434 |
name = "class-gcb3" |
| 435 |
regex = '\p{gcb=ri}' |
| 436 |
haystack = "\U0001F1E7" |
| 437 |
matches = [[0, 4]] |
| 438 |
|
| 439 |
[[test]] |
| 440 |
name = "class-gcb4" |
| 441 |
regex = '\p{regionalindicator}' |
| 442 |
haystack = "\U0001F1FF" |
| 443 |
matches = [[0, 4]] |
| 444 |
|
| 445 |
[[test]] |
| 446 |
name = "class-gcb5" |
| 447 |
regex = '\p{gcb=lvt}' |
| 448 |
haystack = "\uC989" |
| 449 |
matches = [[0, 3]] |
| 450 |
|
| 451 |
[[test]] |
| 452 |
name = "class-gcb6" |
| 453 |
regex = '\p{gcb=zwj}' |
| 454 |
haystack = "\u200D" |
| 455 |
matches = [[0, 3]] |
| 456 |
|
| 457 |
# Tests for Unicode word boundary properties. |
| 458 |
[[test]] |
| 459 |
name = "class-word-break1" |
| 460 |
regex = '\p{word_break=Hebrew_Letter}' |
| 461 |
haystack = "\uFB46" |
| 462 |
matches = [[0, 3]] |
| 463 |
|
| 464 |
[[test]] |
| 465 |
name = "class-word-break2" |
| 466 |
regex = '\p{wb=hebrewletter}' |
| 467 |
haystack = "\uFB46" |
| 468 |
matches = [[0, 3]] |
| 469 |
|
| 470 |
[[test]] |
| 471 |
name = "class-word-break3" |
| 472 |
regex = '\p{wb=ExtendNumLet}' |
| 473 |
haystack = "\uFF3F" |
| 474 |
matches = [[0, 3]] |
| 475 |
|
| 476 |
[[test]] |
| 477 |
name = "class-word-break4" |
| 478 |
regex = '\p{wb=WSegSpace}' |
| 479 |
haystack = "\u3000" |
| 480 |
matches = [[0, 3]] |
| 481 |
|
| 482 |
[[test]] |
| 483 |
name = "class-word-break5" |
| 484 |
regex = '\p{wb=numeric}' |
| 485 |
haystack = "\U0001E950" |
| 486 |
matches = [[0, 4]] |
| 487 |
|
| 488 |
# Tests for Unicode sentence boundary properties. |
| 489 |
[[test]] |
| 490 |
name = "class-sentence-break1" |
| 491 |
regex = '\p{sentence_break=Lower}' |
| 492 |
haystack = "\u0469" |
| 493 |
matches = [[0, 2]] |
| 494 |
|
| 495 |
[[test]] |
| 496 |
name = "class-sentence-break2" |
| 497 |
regex = '\p{sb=lower}' |
| 498 |
haystack = "\u0469" |
| 499 |
matches = [[0, 2]] |
| 500 |
|
| 501 |
[[test]] |
| 502 |
name = "class-sentence-break3" |
| 503 |
regex = '\p{sb=Close}' |
| 504 |
haystack = "\uFF60" |
| 505 |
matches = [[0, 3]] |
| 506 |
|
| 507 |
[[test]] |
| 508 |
name = "class-sentence-break4" |
| 509 |
regex = '\p{sb=Close}' |
| 510 |
haystack = "\U0001F677" |
| 511 |
matches = [[0, 4]] |
| 512 |
|
| 513 |
[[test]] |
| 514 |
name = "class-sentence-break5" |
| 515 |
regex = '\p{sb=SContinue}' |
| 516 |
haystack = "\uFF64" |
| 517 |
matches = [[0, 3]] |