github的一些开源项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7923 lines
126 KiB

  1. # This set of tests check the DFA matching functionality of pcre2_dfa_match(),
  2. # excluding UTF and Unicode property support. All matches are done using DFA,
  3. # forced by setting a default subject modifier at the start.
  4. #forbid_utf
  5. #subject dfa
  6. #newline_default lf anycrlf any
  7. /abc/
  8. abc
  9. 0: abc
  10. /ab*c/
  11. abc
  12. 0: abc
  13. abbbbc
  14. 0: abbbbc
  15. ac
  16. 0: ac
  17. /ab+c/
  18. abc
  19. 0: abc
  20. abbbbbbc
  21. 0: abbbbbbc
  22. \= Expect no match
  23. ac
  24. No match
  25. ab
  26. No match
  27. /a*/no_auto_possess
  28. a
  29. 0: a
  30. 1:
  31. aaaaaaaaaaaaaaaaa
  32. Matched, but offsets vector is too small to show all matches
  33. 0: aaaaaaaaaaaaaaaaa
  34. 1: aaaaaaaaaaaaaaaa
  35. 2: aaaaaaaaaaaaaaa
  36. 3: aaaaaaaaaaaaaa
  37. 4: aaaaaaaaaaaaa
  38. 5: aaaaaaaaaaaa
  39. 6: aaaaaaaaaaa
  40. 7: aaaaaaaaaa
  41. 8: aaaaaaaaa
  42. 9: aaaaaaaa
  43. 10: aaaaaaa
  44. 11: aaaaaa
  45. 12: aaaaa
  46. 13: aaaa
  47. 14: aaa
  48. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=10
  49. Matched, but offsets vector is too small to show all matches
  50. 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  51. 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  52. 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaa
  53. 3: aaaaaaaaaaaaaaaaaaaaaaaaaaa
  54. 4: aaaaaaaaaaaaaaaaaaaaaaaaaa
  55. 5: aaaaaaaaaaaaaaaaaaaaaaaaa
  56. 6: aaaaaaaaaaaaaaaaaaaaaaaa
  57. 7: aaaaaaaaaaaaaaaaaaaaaaa
  58. 8: aaaaaaaaaaaaaaaaaaaaaa
  59. 9: aaaaaaaaaaaaaaaaaaaaa
  60. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=dfa_shortest
  61. 0:
  62. /(a|abcd|african)/
  63. a
  64. 0: a
  65. abcd
  66. 0: abcd
  67. 1: a
  68. african
  69. 0: african
  70. 1: a
  71. /^abc/
  72. abcdef
  73. 0: abc
  74. \= Expect no match
  75. xyzabc
  76. No match
  77. xyz\nabc
  78. No match
  79. /^abc/m
  80. abcdef
  81. 0: abc
  82. xyz\nabc
  83. 0: abc
  84. \= Expect no match
  85. xyzabc
  86. No match
  87. /\Aabc/
  88. abcdef
  89. 0: abc
  90. \= Expect no match
  91. xyzabc
  92. No match
  93. xyz\nabc
  94. No match
  95. /\Aabc/m
  96. abcdef
  97. 0: abc
  98. \= Expect no match
  99. xyzabc
  100. No match
  101. xyz\nabc
  102. No match
  103. /\Gabc/
  104. abcdef
  105. 0: abc
  106. xyzabc\=offset=3
  107. 0: abc
  108. \= Expect no match
  109. xyzabc
  110. No match
  111. xyzabc\=offset=2
  112. No match
  113. /x\dy\Dz/
  114. x9yzz
  115. 0: x9yzz
  116. x0y+z
  117. 0: x0y+z
  118. \= Expect no match
  119. xyz
  120. No match
  121. xxy0z
  122. No match
  123. /x\sy\Sz/
  124. x yzz
  125. 0: x yzz
  126. x y+z
  127. 0: x y+z
  128. \= Expect no match
  129. xyz
  130. No match
  131. xxyyz
  132. No match
  133. /x\wy\Wz/
  134. xxy+z
  135. 0: xxy+z
  136. \= Expect no match
  137. xxy0z
  138. No match
  139. x+y+z
  140. No match
  141. /x.y/
  142. x+y
  143. 0: x+y
  144. x-y
  145. 0: x-y
  146. \= Expect no match
  147. x\ny
  148. No match
  149. /x.y/s
  150. x+y
  151. 0: x+y
  152. x-y
  153. 0: x-y
  154. x\ny
  155. 0: x\x0ay
  156. /(a.b(?s)c.d|x.y)p.q/
  157. a+bc+dp+q
  158. 0: a+bc+dp+q
  159. a+bc\ndp+q
  160. 0: a+bc\x0adp+q
  161. x\nyp+q
  162. 0: x\x0ayp+q
  163. \= Expect no match
  164. a\nbc\ndp+q
  165. No match
  166. a+bc\ndp\nq
  167. No match
  168. x\nyp\nq
  169. No match
  170. /a\d\z/
  171. ba0
  172. 0: a0
  173. \= Expect no match
  174. ba0\n
  175. No match
  176. ba0\ncd
  177. No match
  178. /a\d\z/m
  179. ba0
  180. 0: a0
  181. \= Expect no match
  182. ba0\n
  183. No match
  184. ba0\ncd
  185. No match
  186. /a\d\Z/
  187. ba0
  188. 0: a0
  189. ba0\n
  190. 0: a0
  191. \= Expect no match
  192. ba0\ncd
  193. No match
  194. /a\d\Z/m
  195. ba0
  196. 0: a0
  197. ba0\n
  198. 0: a0
  199. \= Expect no match
  200. ba0\ncd
  201. No match
  202. /a\d$/
  203. ba0
  204. 0: a0
  205. ba0\n
  206. 0: a0
  207. \= Expect no match
  208. ba0\ncd
  209. No match
  210. /a\d$/m
  211. ba0
  212. 0: a0
  213. ba0\n
  214. 0: a0
  215. ba0\ncd
  216. 0: a0
  217. /abc/i
  218. abc
  219. 0: abc
  220. aBc
  221. 0: aBc
  222. ABC
  223. 0: ABC
  224. /[^a]/
  225. abcd
  226. 0: b
  227. /ab?\w/
  228. abz
  229. 0: abz
  230. 1: ab
  231. abbz
  232. 0: abb
  233. 1: ab
  234. azz
  235. 0: az
  236. /x{0,3}yz/
  237. ayzq
  238. 0: yz
  239. axyzq
  240. 0: xyz
  241. axxyz
  242. 0: xxyz
  243. axxxyzq
  244. 0: xxxyz
  245. axxxxyzq
  246. 0: xxxyz
  247. \= Expect no match
  248. ax
  249. No match
  250. axx
  251. No match
  252. /x{3}yz/
  253. axxxyzq
  254. 0: xxxyz
  255. axxxxyzq
  256. 0: xxxyz
  257. \= Expect no match
  258. ax
  259. No match
  260. axx
  261. No match
  262. ayzq
  263. No match
  264. axyzq
  265. No match
  266. axxyz
  267. No match
  268. /x{2,3}yz/
  269. axxyz
  270. 0: xxyz
  271. axxxyzq
  272. 0: xxxyz
  273. axxxxyzq
  274. 0: xxxyz
  275. \= Expect no match
  276. ax
  277. No match
  278. axx
  279. No match
  280. ayzq
  281. No match
  282. axyzq
  283. No match
  284. /[^a]+/no_auto_possess
  285. bac
  286. 0: b
  287. bcdefax
  288. 0: bcdef
  289. 1: bcde
  290. 2: bcd
  291. 3: bc
  292. 4: b
  293. \= Expect no match
  294. aaaaa
  295. No match
  296. /[^a]*/no_auto_possess
  297. bac
  298. 0: b
  299. 1:
  300. bcdefax
  301. 0: bcdef
  302. 1: bcde
  303. 2: bcd
  304. 3: bc
  305. 4: b
  306. 5:
  307. aaaaa
  308. 0:
  309. /[^a]{3,5}/no_auto_possess
  310. xyz
  311. 0: xyz
  312. awxyza
  313. 0: wxyz
  314. 1: wxy
  315. abcdefa
  316. 0: bcdef
  317. 1: bcde
  318. 2: bcd
  319. abcdefghijk
  320. 0: bcdef
  321. 1: bcde
  322. 2: bcd
  323. \= Expect no match
  324. axya
  325. No match
  326. axa
  327. No match
  328. aaaaa
  329. No match
  330. /\d*/
  331. 1234b567
  332. 0: 1234
  333. xyz
  334. 0:
  335. /\D*/
  336. a1234b567
  337. 0: a
  338. xyz
  339. 0: xyz
  340. /\d+/
  341. ab1234c56
  342. 0: 1234
  343. \= Expect no match
  344. xyz
  345. No match
  346. /\D+/
  347. ab123c56
  348. 0: ab
  349. \= Expect no match
  350. 789
  351. No match
  352. /\d?A/
  353. 045ABC
  354. 0: 5A
  355. ABC
  356. 0: A
  357. \= Expect no match
  358. XYZ
  359. No match
  360. /\D?A/
  361. ABC
  362. 0: A
  363. BAC
  364. 0: BA
  365. 9ABC
  366. 0: A
  367. /a+/
  368. aaaa
  369. 0: aaaa
  370. /^.*xyz/
  371. xyz
  372. 0: xyz
  373. ggggggggxyz
  374. 0: ggggggggxyz
  375. /^.+xyz/
  376. abcdxyz
  377. 0: abcdxyz
  378. axyz
  379. 0: axyz
  380. \= Expect no match
  381. xyz
  382. No match
  383. /^.?xyz/
  384. xyz
  385. 0: xyz
  386. cxyz
  387. 0: cxyz
  388. /^\d{2,3}X/
  389. 12X
  390. 0: 12X
  391. 123X
  392. 0: 123X
  393. \= Expect no match
  394. X
  395. No match
  396. 1X
  397. No match
  398. 1234X
  399. No match
  400. /^[abcd]\d/
  401. a45
  402. 0: a4
  403. b93
  404. 0: b9
  405. c99z
  406. 0: c9
  407. d04
  408. 0: d0
  409. \= Expect no match
  410. e45
  411. No match
  412. abcd
  413. No match
  414. abcd1234
  415. No match
  416. 1234
  417. No match
  418. /^[abcd]*\d/
  419. a45
  420. 0: a4
  421. b93
  422. 0: b9
  423. c99z
  424. 0: c9
  425. d04
  426. 0: d0
  427. abcd1234
  428. 0: abcd1
  429. 1234
  430. 0: 1
  431. \= Expect no match
  432. e45
  433. No match
  434. abcd
  435. No match
  436. /^[abcd]+\d/
  437. a45
  438. 0: a4
  439. b93
  440. 0: b9
  441. c99z
  442. 0: c9
  443. d04
  444. 0: d0
  445. abcd1234
  446. 0: abcd1
  447. \= Expect no match
  448. 1234
  449. No match
  450. e45
  451. No match
  452. abcd
  453. No match
  454. /^a+X/
  455. aX
  456. 0: aX
  457. aaX
  458. 0: aaX
  459. /^[abcd]?\d/
  460. a45
  461. 0: a4
  462. b93
  463. 0: b9
  464. c99z
  465. 0: c9
  466. d04
  467. 0: d0
  468. 1234
  469. 0: 1
  470. \= Expect no match
  471. abcd1234
  472. No match
  473. e45
  474. No match
  475. /^[abcd]{2,3}\d/
  476. ab45
  477. 0: ab4
  478. bcd93
  479. 0: bcd9
  480. \= Expect no match
  481. 1234
  482. No match
  483. a36
  484. No match
  485. abcd1234
  486. No match
  487. ee45
  488. No match
  489. /^(abc)*\d/
  490. abc45
  491. 0: abc4
  492. abcabcabc45
  493. 0: abcabcabc4
  494. 42xyz
  495. 0: 4
  496. /^(abc)+\d/
  497. abc45
  498. 0: abc4
  499. abcabcabc45
  500. 0: abcabcabc4
  501. \= Expect no match
  502. 42xyz
  503. No match
  504. /^(abc)?\d/
  505. abc45
  506. 0: abc4
  507. 42xyz
  508. 0: 4
  509. \= Expect no match
  510. abcabcabc45
  511. No match
  512. /^(abc){2,3}\d/
  513. abcabc45
  514. 0: abcabc4
  515. abcabcabc45
  516. 0: abcabcabc4
  517. \= Expect no match
  518. abcabcabcabc45
  519. No match
  520. abc45
  521. No match
  522. 42xyz
  523. No match
  524. /1(abc|xyz)2(?1)3/
  525. 1abc2abc3456
  526. 0: 1abc2abc3
  527. 1abc2xyz3456
  528. 0: 1abc2xyz3
  529. /^(a*\w|ab)=(a*\w|ab)/
  530. ab=ab
  531. 0: ab=ab
  532. 1: ab=a
  533. /^(a*\w|ab)=(?1)/
  534. ab=ab
  535. 0: ab=ab
  536. 1: ab=a
  537. /^([^()]|\((?1)*\))*$/
  538. abc
  539. 0: abc
  540. a(b)c
  541. 0: a(b)c
  542. a(b(c))d
  543. 0: a(b(c))d
  544. \= Expect no match)
  545. a(b(c)d
  546. No match
  547. /^>abc>([^()]|\((?1)*\))*<xyz<$/
  548. >abc>123<xyz<
  549. 0: >abc>123<xyz<
  550. >abc>1(2)3<xyz<
  551. 0: >abc>1(2)3<xyz<
  552. >abc>(1(2)3)<xyz<
  553. 0: >abc>(1(2)3)<xyz<
  554. /^(?>a*)\d/
  555. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9876
  556. 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9
  557. \= Expect no match
  558. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  559. No match
  560. /< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/x
  561. <>
  562. 0: <>
  563. <abcd>
  564. 0: <abcd>
  565. <abc <123> hij>
  566. 0: <abc <123> hij>
  567. <abc <def> hij>
  568. 0: <def>
  569. <abc<>def>
  570. 0: <abc<>def>
  571. <abc<>
  572. 0: <>
  573. \= Expect no match
  574. <abc
  575. No match
  576. /^(?(?=abc)\w{3}:|\d\d)$/
  577. abc:
  578. 0: abc:
  579. 12
  580. 0: 12
  581. \= Expect no match
  582. 123
  583. No match
  584. xyz
  585. No match
  586. /^(?(?!abc)\d\d|\w{3}:)$/
  587. abc:
  588. 0: abc:
  589. 12
  590. 0: 12
  591. \= Expect no match
  592. 123
  593. No match
  594. xyz
  595. No match
  596. /^(?=abc)\w{5}:$/
  597. abcde:
  598. 0: abcde:
  599. \= Expect no match
  600. abc..
  601. No match
  602. 123
  603. No match
  604. vwxyz
  605. No match
  606. /^(?!abc)\d\d$/
  607. 12
  608. 0: 12
  609. \= Expect no match
  610. abcde:
  611. No match
  612. abc..
  613. No match
  614. 123
  615. No match
  616. vwxyz
  617. No match
  618. /(?<=abc|xy)123/
  619. abc12345
  620. 0: 123
  621. wxy123z
  622. 0: 123
  623. \= Expect no match
  624. 123abc
  625. No match
  626. /(?<!abc|xy)123/
  627. 123abc
  628. 0: 123
  629. mno123456
  630. 0: 123
  631. \= Expect no match
  632. abc12345
  633. No match
  634. wxy123z
  635. No match
  636. /abc(?C1)xyz/
  637. abcxyz
  638. --->abcxyz
  639. 1 ^ ^ x
  640. 0: abcxyz
  641. 123abcxyz999
  642. --->123abcxyz999
  643. 1 ^ ^ x
  644. 0: abcxyz
  645. /(ab|cd){3,4}/auto_callout
  646. ababab
  647. --->ababab
  648. +0 ^ (
  649. +1 ^ a
  650. +4 ^ c
  651. +2 ^^ b
  652. +3 ^ ^ |
  653. +1 ^ ^ a
  654. +4 ^ ^ c
  655. +2 ^ ^ b
  656. +3 ^ ^ |
  657. +1 ^ ^ a
  658. +4 ^ ^ c
  659. +2 ^ ^ b
  660. +3 ^ ^ |
  661. +12 ^ ^ End of pattern
  662. +1 ^ ^ a
  663. +4 ^ ^ c
  664. 0: ababab
  665. abcdabcd
  666. --->abcdabcd
  667. +0 ^ (
  668. +1 ^ a
  669. +4 ^ c
  670. +2 ^^ b
  671. +3 ^ ^ |
  672. +1 ^ ^ a
  673. +4 ^ ^ c
  674. +5 ^ ^ d
  675. +6 ^ ^ ){3,4}
  676. +1 ^ ^ a
  677. +4 ^ ^ c
  678. +2 ^ ^ b
  679. +3 ^ ^ |
  680. +12 ^ ^ End of pattern
  681. +1 ^ ^ a
  682. +4 ^ ^ c
  683. +5 ^ ^ d
  684. +6 ^ ^ ){3,4}
  685. +12 ^ ^ End of pattern
  686. 0: abcdabcd
  687. 1: abcdab
  688. abcdcdcdcdcd
  689. --->abcdcdcdcdcd
  690. +0 ^ (
  691. +1 ^ a
  692. +4 ^ c
  693. +2 ^^ b
  694. +3 ^ ^ |
  695. +1 ^ ^ a
  696. +4 ^ ^ c
  697. +5 ^ ^ d
  698. +6 ^ ^ ){3,4}
  699. +1 ^ ^ a
  700. +4 ^ ^ c
  701. +5 ^ ^ d
  702. +6 ^ ^ ){3,4}
  703. +12 ^ ^ End of pattern
  704. +1 ^ ^ a
  705. +4 ^ ^ c
  706. +5 ^ ^ d
  707. +6 ^ ^ ){3,4}
  708. +12 ^ ^ End of pattern
  709. 0: abcdcdcd
  710. 1: abcdcd
  711. /^abc/
  712. abcdef
  713. 0: abc
  714. \= Expect no match
  715. abcdef\=notbol
  716. No match
  717. /^(a*|xyz)/
  718. bcd
  719. 0:
  720. aaabcd
  721. 0: aaa
  722. xyz
  723. 0: xyz
  724. 1:
  725. xyz\=notempty
  726. 0: xyz
  727. \= Expect no match
  728. bcd\=notempty
  729. No match
  730. /xyz$/
  731. xyz
  732. 0: xyz
  733. xyz\n
  734. 0: xyz
  735. \= Expect no match
  736. xyz\=noteol
  737. No match
  738. xyz\n\=noteol
  739. No match
  740. /xyz$/m
  741. xyz
  742. 0: xyz
  743. xyz\n
  744. 0: xyz
  745. abcxyz\npqr
  746. 0: xyz
  747. abcxyz\npqr\=noteol
  748. 0: xyz
  749. xyz\n\=noteol
  750. 0: xyz
  751. \= Expect no match
  752. xyz\=noteol
  753. No match
  754. /\Gabc/
  755. abcdef
  756. 0: abc
  757. defabcxyz\=offset=3
  758. 0: abc
  759. \= Expect no match
  760. defabcxyz
  761. No match
  762. /^abcdef/
  763. ab\=ps
  764. Partial match: ab
  765. abcde\=ps
  766. Partial match: abcde
  767. abcdef\=ps
  768. 0: abcdef
  769. \= Expect no match
  770. abx\=ps
  771. No match
  772. /^a{2,4}\d+z/
  773. a\=ps
  774. Partial match: a
  775. aa\=ps
  776. Partial match: aa
  777. aa2\=ps
  778. Partial match: aa2
  779. aaa\=ps
  780. Partial match: aaa
  781. aaa23\=ps
  782. Partial match: aaa23
  783. aaaa12345\=ps
  784. Partial match: aaaa12345
  785. aa0z\=ps
  786. 0: aa0z
  787. aaaa4444444444444z\=ps
  788. 0: aaaa4444444444444z
  789. \= Expect no match
  790. az\=ps
  791. No match
  792. aaaaa\=ps
  793. No match
  794. a56\=ps
  795. No match
  796. /^abcdef/
  797. abc\=ps
  798. Partial match: abc
  799. def\=dfa_restart
  800. 0: def
  801. /(?<=foo)bar/
  802. foob\=ps,offset=2,allusedtext
  803. Partial match: foob
  804. <<<
  805. foobar...\=ps,dfa_restart,offset=4
  806. 0: ar
  807. foobar\=offset=2
  808. 0: bar
  809. \= Expect no match
  810. xyzfo\=ps
  811. No match
  812. obar\=dfa_restart
  813. No match
  814. /(ab*(cd|ef))+X/
  815. lkjhlkjhlkjhlkjhabbbbbbcdaefabbbbbbbefa\=ps,notbol,noteol
  816. Partial match: abbbbbbcdaefabbbbbbbefa
  817. cdabbbbbbbb\=ps,notbol,dfa_restart,noteol
  818. Partial match: cdabbbbbbbb
  819. efabbbbbbbbbbbbbbbb\=ps,notbol,dfa_restart,noteol
  820. Partial match: efabbbbbbbbbbbbbbbb
  821. bbbbbbbbbbbbcdXyasdfadf\=ps,notbol,dfa_restart,noteol
  822. 0: bbbbbbbbbbbbcdX
  823. \= Expect no match
  824. adfadadaklhlkalkajhlkjahdfasdfasdfladsfjkj\=ps,noteol
  825. No match
  826. /the quick brown fox/
  827. the quick brown fox
  828. 0: the quick brown fox
  829. What do you know about the quick brown fox?
  830. 0: the quick brown fox
  831. \= Expect no match
  832. The quick brown FOX
  833. No match
  834. What do you know about THE QUICK BROWN FOX?
  835. No match
  836. /The quick brown fox/i
  837. the quick brown fox
  838. 0: the quick brown fox
  839. The quick brown FOX
  840. 0: The quick brown FOX
  841. What do you know about the quick brown fox?
  842. 0: the quick brown fox
  843. What do you know about THE QUICK BROWN FOX?
  844. 0: THE QUICK BROWN FOX
  845. /abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
  846. abcd\t\n\r\f\a\e9;\$\\?caxyz
  847. 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz
  848. /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
  849. abxyzpqrrrabbxyyyypqAzz
  850. 0: abxyzpqrrrabbxyyyypqAzz
  851. abxyzpqrrrabbxyyyypqAzz
  852. 0: abxyzpqrrrabbxyyyypqAzz
  853. aabxyzpqrrrabbxyyyypqAzz
  854. 0: aabxyzpqrrrabbxyyyypqAzz
  855. aaabxyzpqrrrabbxyyyypqAzz
  856. 0: aaabxyzpqrrrabbxyyyypqAzz
  857. aaaabxyzpqrrrabbxyyyypqAzz
  858. 0: aaaabxyzpqrrrabbxyyyypqAzz
  859. abcxyzpqrrrabbxyyyypqAzz
  860. 0: abcxyzpqrrrabbxyyyypqAzz
  861. aabcxyzpqrrrabbxyyyypqAzz
  862. 0: aabcxyzpqrrrabbxyyyypqAzz
  863. aaabcxyzpqrrrabbxyyyypAzz
  864. 0: aaabcxyzpqrrrabbxyyyypAzz
  865. aaabcxyzpqrrrabbxyyyypqAzz
  866. 0: aaabcxyzpqrrrabbxyyyypqAzz
  867. aaabcxyzpqrrrabbxyyyypqqAzz
  868. 0: aaabcxyzpqrrrabbxyyyypqqAzz
  869. aaabcxyzpqrrrabbxyyyypqqqAzz
  870. 0: aaabcxyzpqrrrabbxyyyypqqqAzz
  871. aaabcxyzpqrrrabbxyyyypqqqqAzz
  872. 0: aaabcxyzpqrrrabbxyyyypqqqqAzz
  873. aaabcxyzpqrrrabbxyyyypqqqqqAzz
  874. 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz
  875. aaabcxyzpqrrrabbxyyyypqqqqqqAzz
  876. 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz
  877. aaaabcxyzpqrrrabbxyyyypqAzz
  878. 0: aaaabcxyzpqrrrabbxyyyypqAzz
  879. abxyzzpqrrrabbxyyyypqAzz
  880. 0: abxyzzpqrrrabbxyyyypqAzz
  881. aabxyzzzpqrrrabbxyyyypqAzz
  882. 0: aabxyzzzpqrrrabbxyyyypqAzz
  883. aaabxyzzzzpqrrrabbxyyyypqAzz
  884. 0: aaabxyzzzzpqrrrabbxyyyypqAzz
  885. aaaabxyzzzzpqrrrabbxyyyypqAzz
  886. 0: aaaabxyzzzzpqrrrabbxyyyypqAzz
  887. abcxyzzpqrrrabbxyyyypqAzz
  888. 0: abcxyzzpqrrrabbxyyyypqAzz
  889. aabcxyzzzpqrrrabbxyyyypqAzz
  890. 0: aabcxyzzzpqrrrabbxyyyypqAzz
  891. aaabcxyzzzzpqrrrabbxyyyypqAzz
  892. 0: aaabcxyzzzzpqrrrabbxyyyypqAzz
  893. aaaabcxyzzzzpqrrrabbxyyyypqAzz
  894. 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz
  895. aaaabcxyzzzzpqrrrabbbxyyyypqAzz
  896. 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz
  897. aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
  898. 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
  899. aaabcxyzpqrrrabbxyyyypABzz
  900. 0: aaabcxyzpqrrrabbxyyyypABzz
  901. aaabcxyzpqrrrabbxyyyypABBzz
  902. 0: aaabcxyzpqrrrabbxyyyypABBzz
  903. >>>aaabxyzpqrrrabbxyyyypqAzz
  904. 0: aaabxyzpqrrrabbxyyyypqAzz
  905. >aaaabxyzpqrrrabbxyyyypqAzz
  906. 0: aaaabxyzpqrrrabbxyyyypqAzz
  907. >>>>abcxyzpqrrrabbxyyyypqAzz
  908. 0: abcxyzpqrrrabbxyyyypqAzz
  909. \= Expect no match
  910. abxyzpqrrabbxyyyypqAzz
  911. No match
  912. abxyzpqrrrrabbxyyyypqAzz
  913. No match
  914. abxyzpqrrrabxyyyypqAzz
  915. No match
  916. aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
  917. No match
  918. aaaabcxyzzzzpqrrrabbbxyyypqAzz
  919. No match
  920. aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
  921. No match
  922. /^(abc){1,2}zz/
  923. abczz
  924. 0: abczz
  925. abcabczz
  926. 0: abcabczz
  927. \= Expect no match
  928. zz
  929. No match
  930. abcabcabczz
  931. No match
  932. >>abczz
  933. No match
  934. /^(b+?|a){1,2}?c/
  935. bc
  936. 0: bc
  937. bbc
  938. 0: bbc
  939. bbbc
  940. 0: bbbc
  941. bac
  942. 0: bac
  943. bbac
  944. 0: bbac
  945. aac
  946. 0: aac
  947. abbbbbbbbbbbc
  948. 0: abbbbbbbbbbbc
  949. bbbbbbbbbbbac
  950. 0: bbbbbbbbbbbac
  951. \= Expect no match
  952. aaac
  953. No match
  954. abbbbbbbbbbbac
  955. No match
  956. /^(b+|a){1,2}c/
  957. bc
  958. 0: bc
  959. bbc
  960. 0: bbc
  961. bbbc
  962. 0: bbbc
  963. bac
  964. 0: bac
  965. bbac
  966. 0: bbac
  967. aac
  968. 0: aac
  969. abbbbbbbbbbbc
  970. 0: abbbbbbbbbbbc
  971. bbbbbbbbbbbac
  972. 0: bbbbbbbbbbbac
  973. \= Expect no match
  974. aaac
  975. No match
  976. abbbbbbbbbbbac
  977. No match
  978. /^(b+|a){1,2}?bc/
  979. bbc
  980. 0: bbc
  981. /^(b*|ba){1,2}?bc/
  982. babc
  983. 0: babc
  984. bbabc
  985. 0: bbabc
  986. bababc
  987. 0: bababc
  988. \= Expect no match
  989. bababbc
  990. No match
  991. babababc
  992. No match
  993. /^(ba|b*){1,2}?bc/
  994. babc
  995. 0: babc
  996. bbabc
  997. 0: bbabc
  998. bababc
  999. 0: bababc
  1000. \= Expect no match
  1001. bababbc
  1002. No match
  1003. babababc
  1004. No match
  1005. /^\ca\cA\c[\c{\c:/
  1006. \x01\x01\e;z
  1007. 0: \x01\x01\x1b;z
  1008. /^[ab\]cde]/
  1009. athing
  1010. 0: a
  1011. bthing
  1012. 0: b
  1013. ]thing
  1014. 0: ]
  1015. cthing
  1016. 0: c
  1017. dthing
  1018. 0: d
  1019. ething
  1020. 0: e
  1021. \= Expect no match
  1022. fthing
  1023. No match
  1024. [thing
  1025. No match
  1026. \\thing
  1027. No match
  1028. /^[]cde]/
  1029. ]thing
  1030. 0: ]
  1031. cthing
  1032. 0: c
  1033. dthing
  1034. 0: d
  1035. ething
  1036. 0: e
  1037. \= Expect no match
  1038. athing
  1039. No match
  1040. fthing
  1041. No match
  1042. /^[^ab\]cde]/
  1043. fthing
  1044. 0: f
  1045. [thing
  1046. 0: [
  1047. \\thing
  1048. 0: \
  1049. \= Expect no match
  1050. athing
  1051. No match
  1052. bthing
  1053. No match
  1054. ]thing
  1055. No match
  1056. cthing
  1057. No match
  1058. dthing
  1059. No match
  1060. ething
  1061. No match
  1062. /^[^]cde]/
  1063. athing
  1064. 0: a
  1065. fthing
  1066. 0: f
  1067. \= Expect no match
  1068. ]thing
  1069. No match
  1070. cthing
  1071. No match
  1072. dthing
  1073. No match
  1074. ething
  1075. No match
  1076. /^\�/
  1077. 0: \x81
  1078. /^�/
  1079. 0: \xff
  1080. /^[0-9]+$/
  1081. 0
  1082. 0: 0
  1083. 1
  1084. 0: 1
  1085. 2
  1086. 0: 2
  1087. 3
  1088. 0: 3
  1089. 4
  1090. 0: 4
  1091. 5
  1092. 0: 5
  1093. 6
  1094. 0: 6
  1095. 7
  1096. 0: 7
  1097. 8
  1098. 0: 8
  1099. 9
  1100. 0: 9
  1101. 10
  1102. 0: 10
  1103. 100
  1104. 0: 100
  1105. \= Expect no match
  1106. abc
  1107. No match
  1108. /^.*nter/
  1109. enter
  1110. 0: enter
  1111. inter
  1112. 0: inter
  1113. uponter
  1114. 0: uponter
  1115. /^xxx[0-9]+$/
  1116. xxx0
  1117. 0: xxx0
  1118. xxx1234
  1119. 0: xxx1234
  1120. \= Expect no match
  1121. xxx
  1122. No match
  1123. /^.+[0-9][0-9][0-9]$/
  1124. x123
  1125. 0: x123
  1126. xx123
  1127. 0: xx123
  1128. 123456
  1129. 0: 123456
  1130. x1234
  1131. 0: x1234
  1132. \= Expect no match
  1133. 123
  1134. No match
  1135. /^.+?[0-9][0-9][0-9]$/
  1136. x123
  1137. 0: x123
  1138. xx123
  1139. 0: xx123
  1140. 123456
  1141. 0: 123456
  1142. x1234
  1143. 0: x1234
  1144. \= Expect no match
  1145. 123
  1146. No match
  1147. /^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
  1148. abc!pqr=apquxz.ixr.zzz.ac.uk
  1149. 0: abc!pqr=apquxz.ixr.zzz.ac.uk
  1150. \= Expect no match
  1151. !pqr=apquxz.ixr.zzz.ac.uk
  1152. No match
  1153. abc!=apquxz.ixr.zzz.ac.uk
  1154. No match
  1155. abc!pqr=apquxz:ixr.zzz.ac.uk
  1156. No match
  1157. abc!pqr=apquxz.ixr.zzz.ac.ukk
  1158. No match
  1159. /:/
  1160. Well, we need a colon: somewhere
  1161. 0: :
  1162. \= Expect no match
  1163. No match without a colon
  1164. No match
  1165. /([\da-f:]+)$/i
  1166. 0abc
  1167. 0: 0abc
  1168. abc
  1169. 0: abc
  1170. fed
  1171. 0: fed
  1172. E
  1173. 0: E
  1174. ::
  1175. 0: ::
  1176. 5f03:12C0::932e
  1177. 0: 5f03:12C0::932e
  1178. fed def
  1179. 0: def
  1180. Any old stuff
  1181. 0: ff
  1182. \= Expect no match
  1183. 0zzz
  1184. No match
  1185. gzzz
  1186. No match
  1187. fed\x20
  1188. No match
  1189. Any old rubbish
  1190. No match
  1191. /^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
  1192. .1.2.3
  1193. 0: .1.2.3
  1194. A.12.123.0
  1195. 0: A.12.123.0
  1196. \= Expect no match
  1197. .1.2.3333
  1198. No match
  1199. 1.2.3
  1200. No match
  1201. 1234.2.3
  1202. No match
  1203. /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
  1204. 1 IN SOA non-sp1 non-sp2(
  1205. 0: 1 IN SOA non-sp1 non-sp2(
  1206. 1 IN SOA non-sp1 non-sp2 (
  1207. 0: 1 IN SOA non-sp1 non-sp2 (
  1208. \= Expect no match
  1209. 1IN SOA non-sp1 non-sp2(
  1210. No match
  1211. /^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
  1212. a.
  1213. 0: a.
  1214. Z.
  1215. 0: Z.
  1216. 2.
  1217. 0: 2.
  1218. ab-c.pq-r.
  1219. 0: ab-c.pq-r.
  1220. sxk.zzz.ac.uk.
  1221. 0: sxk.zzz.ac.uk.
  1222. x-.y-.
  1223. 0: x-.y-.
  1224. \= Expect no match
  1225. -abc.peq.
  1226. No match
  1227. /^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
  1228. *.a
  1229. 0: *.a
  1230. *.b0-a
  1231. 0: *.b0-a
  1232. *.c3-b.c
  1233. 0: *.c3-b.c
  1234. *.c-a.b-c
  1235. 0: *.c-a.b-c
  1236. \= Expect no match
  1237. *.0
  1238. No match
  1239. *.a-
  1240. No match
  1241. *.a-b.c-
  1242. No match
  1243. *.c-a.0-c
  1244. No match
  1245. /^(?=ab(de))(abd)(e)/
  1246. abde
  1247. 0: abde
  1248. /^(?!(ab)de|x)(abd)(f)/
  1249. abdf
  1250. 0: abdf
  1251. /^(?=(ab(cd)))(ab)/
  1252. abcd
  1253. 0: ab
  1254. /^[\da-f](\.[\da-f])*$/i
  1255. a.b.c.d
  1256. 0: a.b.c.d
  1257. A.B.C.D
  1258. 0: A.B.C.D
  1259. a.b.c.1.2.3.C
  1260. 0: a.b.c.1.2.3.C
  1261. /^\".*\"\s*(;.*)?$/
  1262. \"1234\"
  1263. 0: "1234"
  1264. \"abcd\" ;
  1265. 0: "abcd" ;
  1266. \"\" ; rhubarb
  1267. 0: "" ; rhubarb
  1268. \= Expect no match
  1269. \"1234\" : things
  1270. No match
  1271. /^$/
  1272. \
  1273. 0:
  1274. / ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x
  1275. ab c
  1276. 0: ab c
  1277. \= Expect no match
  1278. abc
  1279. No match
  1280. ab cde
  1281. No match
  1282. /(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/
  1283. ab c
  1284. 0: ab c
  1285. \= Expect no match
  1286. abc
  1287. No match
  1288. ab cde
  1289. No match
  1290. /^ a\ b[c ]d $/x
  1291. a bcd
  1292. 0: a bcd
  1293. a b d
  1294. 0: a b d
  1295. \= Expect no match
  1296. abcd
  1297. No match
  1298. ab d
  1299. No match
  1300. /^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
  1301. abcdefhijklm
  1302. 0: abcdefhijklm
  1303. /^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
  1304. abcdefhijklm
  1305. 0: abcdefhijklm
  1306. /^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
  1307. a+ Z0+\x08\n\x1d\x12
  1308. 0: a+ Z0+\x08\x0a\x1d\x12
  1309. /^[.^$|()*+?{,}]+/
  1310. .^\$(*+)|{?,?}
  1311. 0: .^$(*+)|{?,?}
  1312. /^a*\w/
  1313. z
  1314. 0: z
  1315. az
  1316. 0: az
  1317. 1: a
  1318. aaaz
  1319. 0: aaaz
  1320. 1: aaa
  1321. 2: aa
  1322. 3: a
  1323. a
  1324. 0: a
  1325. aa
  1326. 0: aa
  1327. 1: a
  1328. aaaa
  1329. 0: aaaa
  1330. 1: aaa
  1331. 2: aa
  1332. 3: a
  1333. a+
  1334. 0: a
  1335. aa+
  1336. 0: aa
  1337. 1: a
  1338. /^a*?\w/
  1339. z
  1340. 0: z
  1341. az
  1342. 0: az
  1343. 1: a
  1344. aaaz
  1345. 0: aaaz
  1346. 1: aaa
  1347. 2: aa
  1348. 3: a
  1349. a
  1350. 0: a
  1351. aa
  1352. 0: aa
  1353. 1: a
  1354. aaaa
  1355. 0: aaaa
  1356. 1: aaa
  1357. 2: aa
  1358. 3: a
  1359. a+
  1360. 0: a
  1361. aa+
  1362. 0: aa
  1363. 1: a
  1364. /^a+\w/
  1365. az
  1366. 0: az
  1367. aaaz
  1368. 0: aaaz
  1369. 1: aaa
  1370. 2: aa
  1371. aa
  1372. 0: aa
  1373. aaaa
  1374. 0: aaaa
  1375. 1: aaa
  1376. 2: aa
  1377. aa+
  1378. 0: aa
  1379. /^a+?\w/
  1380. az
  1381. 0: az
  1382. aaaz
  1383. 0: aaaz
  1384. 1: aaa
  1385. 2: aa
  1386. aa
  1387. 0: aa
  1388. aaaa
  1389. 0: aaaa
  1390. 1: aaa
  1391. 2: aa
  1392. aa+
  1393. 0: aa
  1394. /^\d{8}\w{2,}/
  1395. 1234567890
  1396. 0: 1234567890
  1397. 12345678ab
  1398. 0: 12345678ab
  1399. 12345678__
  1400. 0: 12345678__
  1401. \= Expect no match
  1402. 1234567
  1403. No match
  1404. /^[aeiou\d]{4,5}$/
  1405. uoie
  1406. 0: uoie
  1407. 1234
  1408. 0: 1234
  1409. 12345
  1410. 0: 12345
  1411. aaaaa
  1412. 0: aaaaa
  1413. \= Expect no match
  1414. 123456
  1415. No match
  1416. /^[aeiou\d]{4,5}?/
  1417. uoie
  1418. 0: uoie
  1419. 1234
  1420. 0: 1234
  1421. 12345
  1422. 0: 12345
  1423. 1: 1234
  1424. aaaaa
  1425. 0: aaaaa
  1426. 1: aaaa
  1427. 123456
  1428. 0: 12345
  1429. 1: 1234
  1430. /^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/
  1431. From abcd Mon Sep 01 12:33:02 1997
  1432. 0: From abcd Mon Sep 01 12:33
  1433. /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
  1434. From abcd Mon Sep 01 12:33:02 1997
  1435. 0: From abcd Mon Sep 01 12:33
  1436. From abcd Mon Sep 1 12:33:02 1997
  1437. 0: From abcd Mon Sep 1 12:33
  1438. \= Expect no match
  1439. From abcd Sep 01 12:33:02 1997
  1440. No match
  1441. /^12.34/s
  1442. 12\n34
  1443. 0: 12\x0a34
  1444. 12\r34
  1445. 0: 12\x0d34
  1446. /\w+(?=\t)/
  1447. the quick brown\t fox
  1448. 0: brown
  1449. /foo(?!bar)(.*)/
  1450. foobar is foolish see?
  1451. 0: foolish see?
  1452. /(?:(?!foo)...|^.{0,2})bar(.*)/
  1453. foobar crowbar etc
  1454. 0: rowbar etc
  1455. barrel
  1456. 0: barrel
  1457. 2barrel
  1458. 0: 2barrel
  1459. A barrel
  1460. 0: A barrel
  1461. /^(\D*)(?=\d)(?!123)/
  1462. abc456
  1463. 0: abc
  1464. \= Expect no match
  1465. abc123
  1466. No match
  1467. /^1234(?# test newlines
  1468. inside)/
  1469. 1234
  1470. 0: 1234
  1471. /^1234 #comment in extended re
  1472. /x
  1473. 1234
  1474. 0: 1234
  1475. /#rhubarb
  1476. abcd/x
  1477. abcd
  1478. 0: abcd
  1479. /^abcd#rhubarb/x
  1480. abcd
  1481. 0: abcd
  1482. /(?!^)abc/
  1483. the abc
  1484. 0: abc
  1485. \= Expect no match
  1486. abc
  1487. No match
  1488. /(?=^)abc/
  1489. abc
  1490. 0: abc
  1491. \= Expect no match
  1492. the abc
  1493. No match
  1494. /^[ab]{1,3}(ab*|b)/no_auto_possess
  1495. aabbbbb
  1496. 0: aabbbbb
  1497. 1: aabbbb
  1498. 2: aabbb
  1499. 3: aabb
  1500. 4: aab
  1501. 5: aa
  1502. /^[ab]{1,3}?(ab*|b)/no_auto_possess
  1503. aabbbbb
  1504. 0: aabbbbb
  1505. 1: aabbbb
  1506. 2: aabbb
  1507. 3: aabb
  1508. 4: aab
  1509. 5: aa
  1510. /^[ab]{1,3}?(ab*?|b)/no_auto_possess
  1511. aabbbbb
  1512. 0: aabbbbb
  1513. 1: aabbbb
  1514. 2: aabbb
  1515. 3: aabb
  1516. 4: aab
  1517. 5: aa
  1518. /^[ab]{1,3}(ab*?|b)/no_auto_possess
  1519. aabbbbb
  1520. 0: aabbbbb
  1521. 1: aabbbb
  1522. 2: aabbb
  1523. 3: aabb
  1524. 4: aab
  1525. 5: aa
  1526. / (?: [\040\t] | \(
  1527. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1528. \) )* # optional leading comment
  1529. (?: (?:
  1530. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1531. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1532. |
  1533. " (?: # opening quote...
  1534. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  1535. | # or
  1536. \\ [^\x80-\xff] # Escaped something (something != CR)
  1537. )* " # closing quote
  1538. ) # initial word
  1539. (?: (?: [\040\t] | \(
  1540. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1541. \) )* \. (?: [\040\t] | \(
  1542. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1543. \) )* (?:
  1544. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1545. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1546. |
  1547. " (?: # opening quote...
  1548. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  1549. | # or
  1550. \\ [^\x80-\xff] # Escaped something (something != CR)
  1551. )* " # closing quote
  1552. ) )* # further okay, if led by a period
  1553. (?: [\040\t] | \(
  1554. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1555. \) )* @ (?: [\040\t] | \(
  1556. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1557. \) )* (?:
  1558. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1559. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1560. | \[ # [
  1561. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1562. \] # ]
  1563. ) # initial subdomain
  1564. (?: #
  1565. (?: [\040\t] | \(
  1566. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1567. \) )* \. # if led by a period...
  1568. (?: [\040\t] | \(
  1569. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1570. \) )* (?:
  1571. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1572. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1573. | \[ # [
  1574. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1575. \] # ]
  1576. ) # ...further okay
  1577. )*
  1578. # address
  1579. | # or
  1580. (?:
  1581. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1582. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1583. |
  1584. " (?: # opening quote...
  1585. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  1586. | # or
  1587. \\ [^\x80-\xff] # Escaped something (something != CR)
  1588. )* " # closing quote
  1589. ) # one word, optionally followed by....
  1590. (?:
  1591. [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or...
  1592. \(
  1593. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1594. \) | # comments, or...
  1595. " (?: # opening quote...
  1596. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  1597. | # or
  1598. \\ [^\x80-\xff] # Escaped something (something != CR)
  1599. )* " # closing quote
  1600. # quoted strings
  1601. )*
  1602. < (?: [\040\t] | \(
  1603. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1604. \) )* # leading <
  1605. (?: @ (?: [\040\t] | \(
  1606. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1607. \) )* (?:
  1608. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1609. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1610. | \[ # [
  1611. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1612. \] # ]
  1613. ) # initial subdomain
  1614. (?: #
  1615. (?: [\040\t] | \(
  1616. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1617. \) )* \. # if led by a period...
  1618. (?: [\040\t] | \(
  1619. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1620. \) )* (?:
  1621. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1622. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1623. | \[ # [
  1624. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1625. \] # ]
  1626. ) # ...further okay
  1627. )*
  1628. (?: (?: [\040\t] | \(
  1629. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1630. \) )* , (?: [\040\t] | \(
  1631. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1632. \) )* @ (?: [\040\t] | \(
  1633. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1634. \) )* (?:
  1635. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1636. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1637. | \[ # [
  1638. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1639. \] # ]
  1640. ) # initial subdomain
  1641. (?: #
  1642. (?: [\040\t] | \(
  1643. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1644. \) )* \. # if led by a period...
  1645. (?: [\040\t] | \(
  1646. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1647. \) )* (?:
  1648. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1649. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1650. | \[ # [
  1651. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1652. \] # ]
  1653. ) # ...further okay
  1654. )*
  1655. )* # further okay, if led by comma
  1656. : # closing colon
  1657. (?: [\040\t] | \(
  1658. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1659. \) )* )? # optional route
  1660. (?:
  1661. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1662. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1663. |
  1664. " (?: # opening quote...
  1665. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  1666. | # or
  1667. \\ [^\x80-\xff] # Escaped something (something != CR)
  1668. )* " # closing quote
  1669. ) # initial word
  1670. (?: (?: [\040\t] | \(
  1671. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1672. \) )* \. (?: [\040\t] | \(
  1673. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1674. \) )* (?:
  1675. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1676. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1677. |
  1678. " (?: # opening quote...
  1679. [^\\\x80-\xff\n\015"] # Anything except backslash and quote
  1680. | # or
  1681. \\ [^\x80-\xff] # Escaped something (something != CR)
  1682. )* " # closing quote
  1683. ) )* # further okay, if led by a period
  1684. (?: [\040\t] | \(
  1685. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1686. \) )* @ (?: [\040\t] | \(
  1687. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1688. \) )* (?:
  1689. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1690. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1691. | \[ # [
  1692. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1693. \] # ]
  1694. ) # initial subdomain
  1695. (?: #
  1696. (?: [\040\t] | \(
  1697. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1698. \) )* \. # if led by a period...
  1699. (?: [\040\t] | \(
  1700. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1701. \) )* (?:
  1702. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1703. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1704. | \[ # [
  1705. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1706. \] # ]
  1707. ) # ...further okay
  1708. )*
  1709. # address spec
  1710. (?: [\040\t] | \(
  1711. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1712. \) )* > # trailing >
  1713. # name and address
  1714. ) (?: [\040\t] | \(
  1715. (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
  1716. \) )* # optional trailing comment
  1717. /x
  1718. Alan Other <user\@dom.ain>
  1719. 0: Alan Other <user@dom.ain>
  1720. <user\@dom.ain>
  1721. 0: user@dom.ain
  1722. 1: user@dom
  1723. user\@dom.ain
  1724. 0: user@dom.ain
  1725. 1: user@dom
  1726. \"A. Other\" <user.1234\@dom.ain> (a comment)
  1727. 0: "A. Other" <user.1234@dom.ain> (a comment)
  1728. 1: "A. Other" <user.1234@dom.ain>
  1729. 2: "A. Other" <user.1234@dom.ain>
  1730. A. Other <user.1234\@dom.ain> (a comment)
  1731. 0: Other <user.1234@dom.ain> (a comment)
  1732. 1: Other <user.1234@dom.ain>
  1733. 2: Other <user.1234@dom.ain>
  1734. \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
  1735. 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
  1736. 1: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re
  1737. A missing angle <user\@some.where
  1738. 0: user@some.where
  1739. 1: user@some
  1740. \= Expect no match
  1741. The quick brown fox
  1742. No match
  1743. /[\040\t]* # Nab whitespace.
  1744. (?:
  1745. \( # (
  1746. [^\\\x80-\xff\n\015()] * # normal*
  1747. (?: # (
  1748. (?: \\ [^\x80-\xff] |
  1749. \( # (
  1750. [^\\\x80-\xff\n\015()] * # normal*
  1751. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1752. \) # )
  1753. ) # special
  1754. [^\\\x80-\xff\n\015()] * # normal*
  1755. )* # )*
  1756. \) # )
  1757. [\040\t]* )* # If comment found, allow more spaces.
  1758. # optional leading comment
  1759. (?:
  1760. (?:
  1761. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1762. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1763. # Atom
  1764. | # or
  1765. " # "
  1766. [^\\\x80-\xff\n\015"] * # normal
  1767. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1768. " # "
  1769. # Quoted string
  1770. )
  1771. [\040\t]* # Nab whitespace.
  1772. (?:
  1773. \( # (
  1774. [^\\\x80-\xff\n\015()] * # normal*
  1775. (?: # (
  1776. (?: \\ [^\x80-\xff] |
  1777. \( # (
  1778. [^\\\x80-\xff\n\015()] * # normal*
  1779. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1780. \) # )
  1781. ) # special
  1782. [^\\\x80-\xff\n\015()] * # normal*
  1783. )* # )*
  1784. \) # )
  1785. [\040\t]* )* # If comment found, allow more spaces.
  1786. (?:
  1787. \.
  1788. [\040\t]* # Nab whitespace.
  1789. (?:
  1790. \( # (
  1791. [^\\\x80-\xff\n\015()] * # normal*
  1792. (?: # (
  1793. (?: \\ [^\x80-\xff] |
  1794. \( # (
  1795. [^\\\x80-\xff\n\015()] * # normal*
  1796. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1797. \) # )
  1798. ) # special
  1799. [^\\\x80-\xff\n\015()] * # normal*
  1800. )* # )*
  1801. \) # )
  1802. [\040\t]* )* # If comment found, allow more spaces.
  1803. (?:
  1804. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1805. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1806. # Atom
  1807. | # or
  1808. " # "
  1809. [^\\\x80-\xff\n\015"] * # normal
  1810. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1811. " # "
  1812. # Quoted string
  1813. )
  1814. [\040\t]* # Nab whitespace.
  1815. (?:
  1816. \( # (
  1817. [^\\\x80-\xff\n\015()] * # normal*
  1818. (?: # (
  1819. (?: \\ [^\x80-\xff] |
  1820. \( # (
  1821. [^\\\x80-\xff\n\015()] * # normal*
  1822. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1823. \) # )
  1824. ) # special
  1825. [^\\\x80-\xff\n\015()] * # normal*
  1826. )* # )*
  1827. \) # )
  1828. [\040\t]* )* # If comment found, allow more spaces.
  1829. # additional words
  1830. )*
  1831. @
  1832. [\040\t]* # Nab whitespace.
  1833. (?:
  1834. \( # (
  1835. [^\\\x80-\xff\n\015()] * # normal*
  1836. (?: # (
  1837. (?: \\ [^\x80-\xff] |
  1838. \( # (
  1839. [^\\\x80-\xff\n\015()] * # normal*
  1840. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1841. \) # )
  1842. ) # special
  1843. [^\\\x80-\xff\n\015()] * # normal*
  1844. )* # )*
  1845. \) # )
  1846. [\040\t]* )* # If comment found, allow more spaces.
  1847. (?:
  1848. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1849. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1850. |
  1851. \[ # [
  1852. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1853. \] # ]
  1854. )
  1855. [\040\t]* # Nab whitespace.
  1856. (?:
  1857. \( # (
  1858. [^\\\x80-\xff\n\015()] * # normal*
  1859. (?: # (
  1860. (?: \\ [^\x80-\xff] |
  1861. \( # (
  1862. [^\\\x80-\xff\n\015()] * # normal*
  1863. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1864. \) # )
  1865. ) # special
  1866. [^\\\x80-\xff\n\015()] * # normal*
  1867. )* # )*
  1868. \) # )
  1869. [\040\t]* )* # If comment found, allow more spaces.
  1870. # optional trailing comments
  1871. (?:
  1872. \.
  1873. [\040\t]* # Nab whitespace.
  1874. (?:
  1875. \( # (
  1876. [^\\\x80-\xff\n\015()] * # normal*
  1877. (?: # (
  1878. (?: \\ [^\x80-\xff] |
  1879. \( # (
  1880. [^\\\x80-\xff\n\015()] * # normal*
  1881. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1882. \) # )
  1883. ) # special
  1884. [^\\\x80-\xff\n\015()] * # normal*
  1885. )* # )*
  1886. \) # )
  1887. [\040\t]* )* # If comment found, allow more spaces.
  1888. (?:
  1889. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1890. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1891. |
  1892. \[ # [
  1893. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1894. \] # ]
  1895. )
  1896. [\040\t]* # Nab whitespace.
  1897. (?:
  1898. \( # (
  1899. [^\\\x80-\xff\n\015()] * # normal*
  1900. (?: # (
  1901. (?: \\ [^\x80-\xff] |
  1902. \( # (
  1903. [^\\\x80-\xff\n\015()] * # normal*
  1904. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1905. \) # )
  1906. ) # special
  1907. [^\\\x80-\xff\n\015()] * # normal*
  1908. )* # )*
  1909. \) # )
  1910. [\040\t]* )* # If comment found, allow more spaces.
  1911. # optional trailing comments
  1912. )*
  1913. # address
  1914. | # or
  1915. (?:
  1916. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1917. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1918. # Atom
  1919. | # or
  1920. " # "
  1921. [^\\\x80-\xff\n\015"] * # normal
  1922. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1923. " # "
  1924. # Quoted string
  1925. )
  1926. # leading word
  1927. [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces
  1928. (?:
  1929. (?:
  1930. \( # (
  1931. [^\\\x80-\xff\n\015()] * # normal*
  1932. (?: # (
  1933. (?: \\ [^\x80-\xff] |
  1934. \( # (
  1935. [^\\\x80-\xff\n\015()] * # normal*
  1936. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1937. \) # )
  1938. ) # special
  1939. [^\\\x80-\xff\n\015()] * # normal*
  1940. )* # )*
  1941. \) # )
  1942. |
  1943. " # "
  1944. [^\\\x80-\xff\n\015"] * # normal
  1945. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  1946. " # "
  1947. ) # "special" comment or quoted string
  1948. [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal"
  1949. )*
  1950. <
  1951. [\040\t]* # Nab whitespace.
  1952. (?:
  1953. \( # (
  1954. [^\\\x80-\xff\n\015()] * # normal*
  1955. (?: # (
  1956. (?: \\ [^\x80-\xff] |
  1957. \( # (
  1958. [^\\\x80-\xff\n\015()] * # normal*
  1959. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1960. \) # )
  1961. ) # special
  1962. [^\\\x80-\xff\n\015()] * # normal*
  1963. )* # )*
  1964. \) # )
  1965. [\040\t]* )* # If comment found, allow more spaces.
  1966. # <
  1967. (?:
  1968. @
  1969. [\040\t]* # Nab whitespace.
  1970. (?:
  1971. \( # (
  1972. [^\\\x80-\xff\n\015()] * # normal*
  1973. (?: # (
  1974. (?: \\ [^\x80-\xff] |
  1975. \( # (
  1976. [^\\\x80-\xff\n\015()] * # normal*
  1977. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  1978. \) # )
  1979. ) # special
  1980. [^\\\x80-\xff\n\015()] * # normal*
  1981. )* # )*
  1982. \) # )
  1983. [\040\t]* )* # If comment found, allow more spaces.
  1984. (?:
  1985. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  1986. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  1987. |
  1988. \[ # [
  1989. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  1990. \] # ]
  1991. )
  1992. [\040\t]* # Nab whitespace.
  1993. (?:
  1994. \( # (
  1995. [^\\\x80-\xff\n\015()] * # normal*
  1996. (?: # (
  1997. (?: \\ [^\x80-\xff] |
  1998. \( # (
  1999. [^\\\x80-\xff\n\015()] * # normal*
  2000. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2001. \) # )
  2002. ) # special
  2003. [^\\\x80-\xff\n\015()] * # normal*
  2004. )* # )*
  2005. \) # )
  2006. [\040\t]* )* # If comment found, allow more spaces.
  2007. # optional trailing comments
  2008. (?:
  2009. \.
  2010. [\040\t]* # Nab whitespace.
  2011. (?:
  2012. \( # (
  2013. [^\\\x80-\xff\n\015()] * # normal*
  2014. (?: # (
  2015. (?: \\ [^\x80-\xff] |
  2016. \( # (
  2017. [^\\\x80-\xff\n\015()] * # normal*
  2018. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2019. \) # )
  2020. ) # special
  2021. [^\\\x80-\xff\n\015()] * # normal*
  2022. )* # )*
  2023. \) # )
  2024. [\040\t]* )* # If comment found, allow more spaces.
  2025. (?:
  2026. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  2027. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  2028. |
  2029. \[ # [
  2030. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  2031. \] # ]
  2032. )
  2033. [\040\t]* # Nab whitespace.
  2034. (?:
  2035. \( # (
  2036. [^\\\x80-\xff\n\015()] * # normal*
  2037. (?: # (
  2038. (?: \\ [^\x80-\xff] |
  2039. \( # (
  2040. [^\\\x80-\xff\n\015()] * # normal*
  2041. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2042. \) # )
  2043. ) # special
  2044. [^\\\x80-\xff\n\015()] * # normal*
  2045. )* # )*
  2046. \) # )
  2047. [\040\t]* )* # If comment found, allow more spaces.
  2048. # optional trailing comments
  2049. )*
  2050. (?: ,
  2051. [\040\t]* # Nab whitespace.
  2052. (?:
  2053. \( # (
  2054. [^\\\x80-\xff\n\015()] * # normal*
  2055. (?: # (
  2056. (?: \\ [^\x80-\xff] |
  2057. \( # (
  2058. [^\\\x80-\xff\n\015()] * # normal*
  2059. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2060. \) # )
  2061. ) # special
  2062. [^\\\x80-\xff\n\015()] * # normal*
  2063. )* # )*
  2064. \) # )
  2065. [\040\t]* )* # If comment found, allow more spaces.
  2066. @
  2067. [\040\t]* # Nab whitespace.
  2068. (?:
  2069. \( # (
  2070. [^\\\x80-\xff\n\015()] * # normal*
  2071. (?: # (
  2072. (?: \\ [^\x80-\xff] |
  2073. \( # (
  2074. [^\\\x80-\xff\n\015()] * # normal*
  2075. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2076. \) # )
  2077. ) # special
  2078. [^\\\x80-\xff\n\015()] * # normal*
  2079. )* # )*
  2080. \) # )
  2081. [\040\t]* )* # If comment found, allow more spaces.
  2082. (?:
  2083. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  2084. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  2085. |
  2086. \[ # [
  2087. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  2088. \] # ]
  2089. )
  2090. [\040\t]* # Nab whitespace.
  2091. (?:
  2092. \( # (
  2093. [^\\\x80-\xff\n\015()] * # normal*
  2094. (?: # (
  2095. (?: \\ [^\x80-\xff] |
  2096. \( # (
  2097. [^\\\x80-\xff\n\015()] * # normal*
  2098. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2099. \) # )
  2100. ) # special
  2101. [^\\\x80-\xff\n\015()] * # normal*
  2102. )* # )*
  2103. \) # )
  2104. [\040\t]* )* # If comment found, allow more spaces.
  2105. # optional trailing comments
  2106. (?:
  2107. \.
  2108. [\040\t]* # Nab whitespace.
  2109. (?:
  2110. \( # (
  2111. [^\\\x80-\xff\n\015()] * # normal*
  2112. (?: # (
  2113. (?: \\ [^\x80-\xff] |
  2114. \( # (
  2115. [^\\\x80-\xff\n\015()] * # normal*
  2116. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2117. \) # )
  2118. ) # special
  2119. [^\\\x80-\xff\n\015()] * # normal*
  2120. )* # )*
  2121. \) # )
  2122. [\040\t]* )* # If comment found, allow more spaces.
  2123. (?:
  2124. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  2125. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  2126. |
  2127. \[ # [
  2128. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  2129. \] # ]
  2130. )
  2131. [\040\t]* # Nab whitespace.
  2132. (?:
  2133. \( # (
  2134. [^\\\x80-\xff\n\015()] * # normal*
  2135. (?: # (
  2136. (?: \\ [^\x80-\xff] |
  2137. \( # (
  2138. [^\\\x80-\xff\n\015()] * # normal*
  2139. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2140. \) # )
  2141. ) # special
  2142. [^\\\x80-\xff\n\015()] * # normal*
  2143. )* # )*
  2144. \) # )
  2145. [\040\t]* )* # If comment found, allow more spaces.
  2146. # optional trailing comments
  2147. )*
  2148. )* # additional domains
  2149. :
  2150. [\040\t]* # Nab whitespace.
  2151. (?:
  2152. \( # (
  2153. [^\\\x80-\xff\n\015()] * # normal*
  2154. (?: # (
  2155. (?: \\ [^\x80-\xff] |
  2156. \( # (
  2157. [^\\\x80-\xff\n\015()] * # normal*
  2158. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2159. \) # )
  2160. ) # special
  2161. [^\\\x80-\xff\n\015()] * # normal*
  2162. )* # )*
  2163. \) # )
  2164. [\040\t]* )* # If comment found, allow more spaces.
  2165. # optional trailing comments
  2166. )? # optional route
  2167. (?:
  2168. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  2169. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  2170. # Atom
  2171. | # or
  2172. " # "
  2173. [^\\\x80-\xff\n\015"] * # normal
  2174. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  2175. " # "
  2176. # Quoted string
  2177. )
  2178. [\040\t]* # Nab whitespace.
  2179. (?:
  2180. \( # (
  2181. [^\\\x80-\xff\n\015()] * # normal*
  2182. (?: # (
  2183. (?: \\ [^\x80-\xff] |
  2184. \( # (
  2185. [^\\\x80-\xff\n\015()] * # normal*
  2186. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2187. \) # )
  2188. ) # special
  2189. [^\\\x80-\xff\n\015()] * # normal*
  2190. )* # )*
  2191. \) # )
  2192. [\040\t]* )* # If comment found, allow more spaces.
  2193. (?:
  2194. \.
  2195. [\040\t]* # Nab whitespace.
  2196. (?:
  2197. \( # (
  2198. [^\\\x80-\xff\n\015()] * # normal*
  2199. (?: # (
  2200. (?: \\ [^\x80-\xff] |
  2201. \( # (
  2202. [^\\\x80-\xff\n\015()] * # normal*
  2203. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2204. \) # )
  2205. ) # special
  2206. [^\\\x80-\xff\n\015()] * # normal*
  2207. )* # )*
  2208. \) # )
  2209. [\040\t]* )* # If comment found, allow more spaces.
  2210. (?:
  2211. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  2212. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  2213. # Atom
  2214. | # or
  2215. " # "
  2216. [^\\\x80-\xff\n\015"] * # normal
  2217. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
  2218. " # "
  2219. # Quoted string
  2220. )
  2221. [\040\t]* # Nab whitespace.
  2222. (?:
  2223. \( # (
  2224. [^\\\x80-\xff\n\015()] * # normal*
  2225. (?: # (
  2226. (?: \\ [^\x80-\xff] |
  2227. \( # (
  2228. [^\\\x80-\xff\n\015()] * # normal*
  2229. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2230. \) # )
  2231. ) # special
  2232. [^\\\x80-\xff\n\015()] * # normal*
  2233. )* # )*
  2234. \) # )
  2235. [\040\t]* )* # If comment found, allow more spaces.
  2236. # additional words
  2237. )*
  2238. @
  2239. [\040\t]* # Nab whitespace.
  2240. (?:
  2241. \( # (
  2242. [^\\\x80-\xff\n\015()] * # normal*
  2243. (?: # (
  2244. (?: \\ [^\x80-\xff] |
  2245. \( # (
  2246. [^\\\x80-\xff\n\015()] * # normal*
  2247. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2248. \) # )
  2249. ) # special
  2250. [^\\\x80-\xff\n\015()] * # normal*
  2251. )* # )*
  2252. \) # )
  2253. [\040\t]* )* # If comment found, allow more spaces.
  2254. (?:
  2255. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  2256. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  2257. |
  2258. \[ # [
  2259. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  2260. \] # ]
  2261. )
  2262. [\040\t]* # Nab whitespace.
  2263. (?:
  2264. \( # (
  2265. [^\\\x80-\xff\n\015()] * # normal*
  2266. (?: # (
  2267. (?: \\ [^\x80-\xff] |
  2268. \( # (
  2269. [^\\\x80-\xff\n\015()] * # normal*
  2270. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2271. \) # )
  2272. ) # special
  2273. [^\\\x80-\xff\n\015()] * # normal*
  2274. )* # )*
  2275. \) # )
  2276. [\040\t]* )* # If comment found, allow more spaces.
  2277. # optional trailing comments
  2278. (?:
  2279. \.
  2280. [\040\t]* # Nab whitespace.
  2281. (?:
  2282. \( # (
  2283. [^\\\x80-\xff\n\015()] * # normal*
  2284. (?: # (
  2285. (?: \\ [^\x80-\xff] |
  2286. \( # (
  2287. [^\\\x80-\xff\n\015()] * # normal*
  2288. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2289. \) # )
  2290. ) # special
  2291. [^\\\x80-\xff\n\015()] * # normal*
  2292. )* # )*
  2293. \) # )
  2294. [\040\t]* )* # If comment found, allow more spaces.
  2295. (?:
  2296. [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
  2297. (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
  2298. |
  2299. \[ # [
  2300. (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
  2301. \] # ]
  2302. )
  2303. [\040\t]* # Nab whitespace.
  2304. (?:
  2305. \( # (
  2306. [^\\\x80-\xff\n\015()] * # normal*
  2307. (?: # (
  2308. (?: \\ [^\x80-\xff] |
  2309. \( # (
  2310. [^\\\x80-\xff\n\015()] * # normal*
  2311. (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
  2312. \) # )
  2313. ) # special
  2314. [^\\\x80-\xff\n\015()] * # normal*
  2315. )* # )*
  2316. \) # )
  2317. [\040\t]* )* # If comment found, allow more spaces.
  2318. # optional trailing comments
  2319. )*
  2320. # address spec
  2321. > # >
  2322. # name and address
  2323. )
  2324. /x
  2325. Alan Other <user\@dom.ain>
  2326. 0: Alan Other <user@dom.ain>
  2327. <user\@dom.ain>
  2328. 0: user@dom.ain
  2329. 1: user@dom
  2330. user\@dom.ain
  2331. 0: user@dom.ain
  2332. 1: user@dom
  2333. \"A. Other\" <user.1234\@dom.ain> (a comment)
  2334. 0: "A. Other" <user.1234@dom.ain>
  2335. A. Other <user.1234\@dom.ain> (a comment)
  2336. 0: Other <user.1234@dom.ain>
  2337. \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
  2338. 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
  2339. 1: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re
  2340. A missing angle <user\@some.where
  2341. 0: user@some.where
  2342. 1: user@some
  2343. \= Expect no match
  2344. The quick brown fox
  2345. No match
  2346. /abc\0def\00pqr\000xyz\0000AB/
  2347. abc\0def\00pqr\000xyz\0000AB
  2348. 0: abc\x00def\x00pqr\x00xyz\x000AB
  2349. abc456 abc\0def\00pqr\000xyz\0000ABCDE
  2350. 0: abc\x00def\x00pqr\x00xyz\x000AB
  2351. /abc\x0def\x00pqr\x000xyz\x0000AB/
  2352. abc\x0def\x00pqr\x000xyz\x0000AB
  2353. 0: abc\x0def\x00pqr\x000xyz\x0000AB
  2354. abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
  2355. 0: abc\x0def\x00pqr\x000xyz\x0000AB
  2356. /^[\000-\037]/
  2357. \0A
  2358. 0: \x00
  2359. \01B
  2360. 0: \x01
  2361. \037C
  2362. 0: \x1f
  2363. /\0*/
  2364. \0\0\0\0
  2365. 0: \x00\x00\x00\x00
  2366. /A\x0{2,3}Z/
  2367. The A\x0\x0Z
  2368. 0: A\x00\x00Z
  2369. An A\0\x0\0Z
  2370. 0: A\x00\x00\x00Z
  2371. \= Expect no match
  2372. A\0Z
  2373. No match
  2374. A\0\x0\0\x0Z
  2375. No match
  2376. /^\s/
  2377. \040abc
  2378. 0:
  2379. \x0cabc
  2380. 0: \x0c
  2381. \nabc
  2382. 0: \x0a
  2383. \rabc
  2384. 0: \x0d
  2385. \tabc
  2386. 0: \x09
  2387. \= Expect no match
  2388. abc
  2389. No match
  2390. /^a b
  2391. c/x
  2392. abc
  2393. 0: abc
  2394. /ab{1,3}bc/
  2395. abbbbc
  2396. 0: abbbbc
  2397. abbbc
  2398. 0: abbbc
  2399. abbc
  2400. 0: abbc
  2401. \= Expect no match
  2402. abc
  2403. No match
  2404. abbbbbc
  2405. No match
  2406. /([^.]*)\.([^:]*):[T ]+(.*)/
  2407. track1.title:TBlah blah blah
  2408. 0: track1.title:TBlah blah blah
  2409. /([^.]*)\.([^:]*):[T ]+(.*)/i
  2410. track1.title:TBlah blah blah
  2411. 0: track1.title:TBlah blah blah
  2412. /([^.]*)\.([^:]*):[t ]+(.*)/i
  2413. track1.title:TBlah blah blah
  2414. 0: track1.title:TBlah blah blah
  2415. /^[W-c]+$/
  2416. WXY_^abc
  2417. 0: WXY_^abc
  2418. \= Expect no match
  2419. wxy
  2420. No match
  2421. /^[W-c]+$/i
  2422. WXY_^abc
  2423. 0: WXY_^abc
  2424. wxy_^ABC
  2425. 0: wxy_^ABC
  2426. /^[\x3f-\x5F]+$/i
  2427. WXY_^abc
  2428. 0: WXY_^abc
  2429. wxy_^ABC
  2430. 0: wxy_^ABC
  2431. /^abc$/m
  2432. abc
  2433. 0: abc
  2434. qqq\nabc
  2435. 0: abc
  2436. abc\nzzz
  2437. 0: abc
  2438. qqq\nabc\nzzz
  2439. 0: abc
  2440. /^abc$/
  2441. abc
  2442. 0: abc
  2443. \= Expect no match
  2444. qqq\nabc
  2445. No match
  2446. abc\nzzz
  2447. No match
  2448. qqq\nabc\nzzz
  2449. No match
  2450. /\Aabc\Z/m
  2451. abc
  2452. 0: abc
  2453. abc\n
  2454. 0: abc
  2455. \= Expect no match
  2456. qqq\nabc
  2457. No match
  2458. abc\nzzz
  2459. No match
  2460. qqq\nabc\nzzz
  2461. No match
  2462. /\A(.)*\Z/s
  2463. abc\ndef
  2464. 0: abc\x0adef
  2465. /\A(.)*\Z/m
  2466. \= Expect no match
  2467. abc\ndef
  2468. No match
  2469. /(?:b)|(?::+)/
  2470. b::c
  2471. 0: b
  2472. c::b
  2473. 0: ::
  2474. /[-az]+/
  2475. az-
  2476. 0: az-
  2477. \= Expect no match
  2478. b
  2479. No match
  2480. /[az-]+/
  2481. za-
  2482. 0: za-
  2483. \= Expect no match
  2484. b
  2485. No match
  2486. /[a\-z]+/
  2487. a-z
  2488. 0: a-z
  2489. \= Expect no match
  2490. b
  2491. No match
  2492. /[a-z]+/
  2493. abcdxyz
  2494. 0: abcdxyz
  2495. /[\d-]+/
  2496. 12-34
  2497. 0: 12-34
  2498. \= Expect no match
  2499. aaa
  2500. No match
  2501. /\x5c/
  2502. \\
  2503. 0: \
  2504. /\x20Z/
  2505. the Zoo
  2506. 0: Z
  2507. \= Expect no match
  2508. Zulu
  2509. No match
  2510. /ab{3cd/
  2511. ab{3cd
  2512. 0: ab{3cd
  2513. /ab{3,cd/
  2514. ab{3,cd
  2515. 0: ab{3,cd
  2516. /ab{3,4a}cd/
  2517. ab{3,4a}cd
  2518. 0: ab{3,4a}cd
  2519. /{4,5a}bc/
  2520. {4,5a}bc
  2521. 0: {4,5a}bc
  2522. /^a.b/newline=lf
  2523. a\rb
  2524. 0: a\x0db
  2525. \= Expect no match
  2526. a\nb
  2527. No match
  2528. /abc$/
  2529. abc
  2530. 0: abc
  2531. abc\n
  2532. 0: abc
  2533. \= Expect no match
  2534. abc\ndef
  2535. No match
  2536. /(abc)\123/
  2537. abc\x53
  2538. 0: abcS
  2539. /(abc)\223/
  2540. abc\x93
  2541. 0: abc\x93
  2542. /(abc)\323/
  2543. abc\xd3
  2544. 0: abc\xd3
  2545. /(abc)\100/
  2546. abc\x40
  2547. 0: abc@
  2548. abc\100
  2549. 0: abc@
  2550. /(abc)\1000/
  2551. abc\x400
  2552. 0: abc@0
  2553. abc\x40\x30
  2554. 0: abc@0
  2555. abc\1000
  2556. 0: abc@0
  2557. abc\100\x30
  2558. 0: abc@0
  2559. abc\100\060
  2560. 0: abc@0
  2561. abc\100\60
  2562. 0: abc@0
  2563. /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
  2564. abcdefghijk\12S
  2565. 0: abcdefghijk\x0aS
  2566. /a{0}bc/
  2567. bc
  2568. 0: bc
  2569. /(a|(bc)){0,0}?xyz/
  2570. xyz
  2571. 0: xyz
  2572. /abc[\10]de/
  2573. abc\010de
  2574. 0: abc\x08de
  2575. /abc[\1]de/
  2576. abc\1de
  2577. 0: abc\x01de
  2578. /(abc)[\1]de/
  2579. abc\1de
  2580. 0: abc\x01de
  2581. /(?s)a.b/
  2582. a\nb
  2583. 0: a\x0ab
  2584. /^([^a])([^\b])([^c]*)([^d]{3,4})/
  2585. baNOTccccd
  2586. 0: baNOTcccc
  2587. 1: baNOTccc
  2588. 2: baNOTcc
  2589. 3: baNOTc
  2590. baNOTcccd
  2591. 0: baNOTccc
  2592. 1: baNOTcc
  2593. 2: baNOTc
  2594. baNOTccd
  2595. 0: baNOTcc
  2596. 1: baNOTc
  2597. bacccd
  2598. 0: baccc
  2599. \= Expect no match
  2600. anything
  2601. No match
  2602. b\bc
  2603. No match
  2604. baccd
  2605. No match
  2606. /[^a]/
  2607. Abc
  2608. 0: A
  2609. /[^a]/i
  2610. Abc
  2611. 0: b
  2612. /[^a]+/
  2613. AAAaAbc
  2614. 0: AAA
  2615. /[^a]+/i
  2616. AAAaAbc
  2617. 0: bc
  2618. /[^a]+/
  2619. bbb\nccc
  2620. 0: bbb\x0accc
  2621. /[^k]$/
  2622. abc
  2623. 0: c
  2624. \= Expect no match
  2625. abk
  2626. No match
  2627. /[^k]{2,3}$/
  2628. abc
  2629. 0: abc
  2630. kbc
  2631. 0: bc
  2632. kabc
  2633. 0: abc
  2634. \= Expect no match
  2635. abk
  2636. No match
  2637. akb
  2638. No match
  2639. akk
  2640. No match
  2641. /^\d{8,}\@.+[^k]$/
  2642. 12345678\@a.b.c.d
  2643. 0: 12345678@a.b.c.d
  2644. 123456789\@x.y.z
  2645. 0: 123456789@x.y.z
  2646. \= Expect no match
  2647. 12345678\@x.y.uk
  2648. No match
  2649. 1234567\@a.b.c.d
  2650. No match
  2651. /[^a]/
  2652. aaaabcd
  2653. 0: b
  2654. aaAabcd
  2655. 0: A
  2656. /[^a]/i
  2657. aaaabcd
  2658. 0: b
  2659. aaAabcd
  2660. 0: b
  2661. /[^az]/
  2662. aaaabcd
  2663. 0: b
  2664. aaAabcd
  2665. 0: A
  2666. /[^az]/i
  2667. aaaabcd
  2668. 0: b
  2669. aaAabcd
  2670. 0: b
  2671. /\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
  2672. \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
  2673. 0: \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff
  2674. /P[^*]TAIRE[^*]{1,6}?LL/
  2675. xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
  2676. 0: PSTAIREISLL
  2677. /P[^*]TAIRE[^*]{1,}?LL/
  2678. xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
  2679. 0: PSTAIREISLL
  2680. /(\.\d\d[1-9]?)\d+/
  2681. 1.230003938
  2682. 0: .230003938
  2683. 1.875000282
  2684. 0: .875000282
  2685. 1.235
  2686. 0: .235
  2687. /(\.\d\d((?=0)|\d(?=\d)))/
  2688. 1.230003938
  2689. 0: .230
  2690. 1: .23
  2691. 1.875000282
  2692. 0: .875
  2693. \= Expect no match
  2694. 1.235
  2695. No match
  2696. /a(?)b/
  2697. ab
  2698. 0: ab
  2699. /\b(foo)\s+(\w+)/i
  2700. Food is on the foo table
  2701. 0: foo table
  2702. /foo(.*)bar/
  2703. The food is under the bar in the barn.
  2704. 0: food is under the bar in the bar
  2705. 1: food is under the bar
  2706. /foo(.*?)bar/
  2707. The food is under the bar in the barn.
  2708. 0: food is under the bar in the bar
  2709. 1: food is under the bar
  2710. /(.*)(\d*)/no_auto_possess
  2711. I have 2 numbers: 53147
  2712. Matched, but offsets vector is too small to show all matches
  2713. 0: I have 2 numbers: 53147
  2714. 1: I have 2 numbers: 5314
  2715. 2: I have 2 numbers: 531
  2716. 3: I have 2 numbers: 53
  2717. 4: I have 2 numbers: 5
  2718. 5: I have 2 numbers:
  2719. 6: I have 2 numbers:
  2720. 7: I have 2 numbers
  2721. 8: I have 2 number
  2722. 9: I have 2 numbe
  2723. 10: I have 2 numb
  2724. 11: I have 2 num
  2725. 12: I have 2 nu
  2726. 13: I have 2 n
  2727. 14: I have 2
  2728. /(.*)(\d+)/
  2729. I have 2 numbers: 53147
  2730. 0: I have 2 numbers: 53147
  2731. 1: I have 2
  2732. /(.*?)(\d*)/no_auto_possess
  2733. I have 2 numbers: 53147
  2734. Matched, but offsets vector is too small to show all matches
  2735. 0: I have 2 numbers: 53147
  2736. 1: I have 2 numbers: 5314
  2737. 2: I have 2 numbers: 531
  2738. 3: I have 2 numbers: 53
  2739. 4: I have 2 numbers: 5
  2740. 5: I have 2 numbers:
  2741. 6: I have 2 numbers:
  2742. 7: I have 2 numbers
  2743. 8: I have 2 number
  2744. 9: I have 2 numbe
  2745. 10: I have 2 numb
  2746. 11: I have 2 num
  2747. 12: I have 2 nu
  2748. 13: I have 2 n
  2749. 14: I have 2
  2750. /(.*?)(\d+)/
  2751. I have 2 numbers: 53147
  2752. 0: I have 2 numbers: 53147
  2753. 1: I have 2
  2754. /(.*)(\d+)$/
  2755. I have 2 numbers: 53147
  2756. 0: I have 2 numbers: 53147
  2757. /(.*?)(\d+)$/
  2758. I have 2 numbers: 53147
  2759. 0: I have 2 numbers: 53147
  2760. /(.*)\b(\d+)$/
  2761. I have 2 numbers: 53147
  2762. 0: I have 2 numbers: 53147
  2763. /(.*\D)(\d+)$/
  2764. I have 2 numbers: 53147
  2765. 0: I have 2 numbers: 53147
  2766. /^\D*(?!123)/
  2767. ABC123
  2768. 0: AB
  2769. 1: A
  2770. 2:
  2771. /^(\D*)(?=\d)(?!123)/
  2772. ABC445
  2773. 0: ABC
  2774. \= Expect no match
  2775. ABC123
  2776. No match
  2777. /^[W-]46]/
  2778. W46]789
  2779. 0: W46]
  2780. -46]789
  2781. 0: -46]
  2782. \= Expect no match
  2783. Wall
  2784. No match
  2785. Zebra
  2786. No match
  2787. 42
  2788. No match
  2789. [abcd]
  2790. No match
  2791. ]abcd[
  2792. No match
  2793. /^[W-\]46]/
  2794. W46]789
  2795. 0: W
  2796. Wall
  2797. 0: W
  2798. Zebra
  2799. 0: Z
  2800. Xylophone
  2801. 0: X
  2802. 42
  2803. 0: 4
  2804. [abcd]
  2805. 0: [
  2806. ]abcd[
  2807. 0: ]
  2808. \\backslash
  2809. 0: \
  2810. \= Expect no match
  2811. -46]789
  2812. No match
  2813. well
  2814. No match
  2815. /\d\d\/\d\d\/\d\d\d\d/
  2816. 01/01/2000
  2817. 0: 01/01/2000
  2818. /word (?:[a-zA-Z0-9]+ ){0,10}otherword/
  2819. word cat dog elephant mussel cow horse canary baboon snake shark otherword
  2820. 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
  2821. \= Expect no match
  2822. word cat dog elephant mussel cow horse canary baboon snake shark
  2823. No match
  2824. /word (?:[a-zA-Z0-9]+ ){0,300}otherword/
  2825. \= Expect no match
  2826. word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
  2827. No match
  2828. /^(a){0,0}/
  2829. bcd
  2830. 0:
  2831. abc
  2832. 0:
  2833. aab
  2834. 0:
  2835. /^(a){0,1}/
  2836. bcd
  2837. 0:
  2838. abc
  2839. 0: a
  2840. 1:
  2841. aab
  2842. 0: a
  2843. 1:
  2844. /^(a){0,2}/
  2845. bcd
  2846. 0:
  2847. abc
  2848. 0: a
  2849. 1:
  2850. aab
  2851. 0: aa
  2852. 1: a
  2853. 2:
  2854. /^(a){0,3}/
  2855. bcd
  2856. 0:
  2857. abc
  2858. 0: a
  2859. 1:
  2860. aab
  2861. 0: aa
  2862. 1: a
  2863. 2:
  2864. aaa
  2865. 0: aaa
  2866. 1: aa
  2867. 2: a
  2868. 3:
  2869. /^(a){0,}/
  2870. bcd
  2871. 0:
  2872. abc
  2873. 0: a
  2874. 1:
  2875. aab
  2876. 0: aa
  2877. 1: a
  2878. 2:
  2879. aaa
  2880. 0: aaa
  2881. 1: aa
  2882. 2: a
  2883. 3:
  2884. aaaaaaaa
  2885. 0: aaaaaaaa
  2886. 1: aaaaaaa
  2887. 2: aaaaaa
  2888. 3: aaaaa
  2889. 4: aaaa
  2890. 5: aaa
  2891. 6: aa
  2892. 7: a
  2893. 8:
  2894. /^(a){1,1}/
  2895. abc
  2896. 0: a
  2897. aab
  2898. 0: a
  2899. \= Expect no match
  2900. bcd
  2901. No match
  2902. /^(a){1,2}/
  2903. abc
  2904. 0: a
  2905. aab
  2906. 0: aa
  2907. 1: a
  2908. \= Expect no match
  2909. bcd
  2910. No match
  2911. /^(a){1,3}/
  2912. abc
  2913. 0: a
  2914. aab
  2915. 0: aa
  2916. 1: a
  2917. aaa
  2918. 0: aaa
  2919. 1: aa
  2920. 2: a
  2921. \= Expect no match
  2922. bcd
  2923. No match
  2924. /^(a){1,}/
  2925. abc
  2926. 0: a
  2927. aab
  2928. 0: aa
  2929. 1: a
  2930. aaa
  2931. 0: aaa
  2932. 1: aa
  2933. 2: a
  2934. aaaaaaaa
  2935. 0: aaaaaaaa
  2936. 1: aaaaaaa
  2937. 2: aaaaaa
  2938. 3: aaaaa
  2939. 4: aaaa
  2940. 5: aaa
  2941. 6: aa
  2942. 7: a
  2943. \= Expect no match
  2944. bcd
  2945. No match
  2946. /.*\.gif/
  2947. borfle\nbib.gif\nno
  2948. 0: bib.gif
  2949. /.{0,}\.gif/
  2950. borfle\nbib.gif\nno
  2951. 0: bib.gif
  2952. /.*\.gif/m
  2953. borfle\nbib.gif\nno
  2954. 0: bib.gif
  2955. /.*\.gif/s
  2956. borfle\nbib.gif\nno
  2957. 0: borfle\x0abib.gif
  2958. /.*\.gif/ms
  2959. borfle\nbib.gif\nno
  2960. 0: borfle\x0abib.gif
  2961. /.*$/
  2962. borfle\nbib.gif\nno
  2963. 0: no
  2964. /.*$/m
  2965. borfle\nbib.gif\nno
  2966. 0: borfle
  2967. /.*$/s
  2968. borfle\nbib.gif\nno
  2969. 0: borfle\x0abib.gif\x0ano
  2970. /.*$/ms
  2971. borfle\nbib.gif\nno
  2972. 0: borfle\x0abib.gif\x0ano
  2973. 1: borfle\x0abib.gif
  2974. 2: borfle
  2975. /.*$/
  2976. borfle\nbib.gif\nno\n
  2977. 0: no
  2978. /.*$/m
  2979. borfle\nbib.gif\nno\n
  2980. 0: borfle
  2981. /.*$/s
  2982. borfle\nbib.gif\nno\n
  2983. 0: borfle\x0abib.gif\x0ano\x0a
  2984. 1: borfle\x0abib.gif\x0ano
  2985. /.*$/ms
  2986. borfle\nbib.gif\nno\n
  2987. 0: borfle\x0abib.gif\x0ano\x0a
  2988. 1: borfle\x0abib.gif\x0ano
  2989. 2: borfle\x0abib.gif
  2990. 3: borfle
  2991. /(.*X|^B)/
  2992. abcde\n1234Xyz
  2993. 0: 1234X
  2994. BarFoo
  2995. 0: B
  2996. \= Expect no match
  2997. abcde\nBar
  2998. No match
  2999. /(.*X|^B)/m
  3000. abcde\n1234Xyz
  3001. 0: 1234X
  3002. BarFoo
  3003. 0: B
  3004. abcde\nBar
  3005. 0: B
  3006. /(.*X|^B)/s
  3007. abcde\n1234Xyz
  3008. 0: abcde\x0a1234X
  3009. BarFoo
  3010. 0: B
  3011. \= Expect no match
  3012. abcde\nBar
  3013. No match
  3014. /(.*X|^B)/ms
  3015. abcde\n1234Xyz
  3016. 0: abcde\x0a1234X
  3017. BarFoo
  3018. 0: B
  3019. abcde\nBar
  3020. 0: B
  3021. /(?s)(.*X|^B)/
  3022. abcde\n1234Xyz
  3023. 0: abcde\x0a1234X
  3024. BarFoo
  3025. 0: B
  3026. \= Expect no match
  3027. abcde\nBar
  3028. No match
  3029. /(?s:.*X|^B)/
  3030. abcde\n1234Xyz
  3031. 0: abcde\x0a1234X
  3032. BarFoo
  3033. 0: B
  3034. \= Expect no match
  3035. abcde\nBar
  3036. No match
  3037. /^.*B/
  3038. \= Expect no match
  3039. abc\nB
  3040. No match
  3041. /(?s)^.*B/
  3042. abc\nB
  3043. 0: abc\x0aB
  3044. /(?m)^.*B/
  3045. abc\nB
  3046. 0: B
  3047. /(?ms)^.*B/
  3048. abc\nB
  3049. 0: abc\x0aB
  3050. /(?ms)^B/
  3051. abc\nB
  3052. 0: B
  3053. /(?s)B$/
  3054. B\n
  3055. 0: B
  3056. /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
  3057. 123456654321
  3058. 0: 123456654321
  3059. /^\d\d\d\d\d\d\d\d\d\d\d\d/
  3060. 123456654321
  3061. 0: 123456654321
  3062. /^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
  3063. 123456654321
  3064. 0: 123456654321
  3065. /^[abc]{12}/
  3066. abcabcabcabc
  3067. 0: abcabcabcabc
  3068. /^[a-c]{12}/
  3069. abcabcabcabc
  3070. 0: abcabcabcabc
  3071. /^(a|b|c){12}/
  3072. abcabcabcabc
  3073. 0: abcabcabcabc
  3074. /^[abcdefghijklmnopqrstuvwxy0123456789]/
  3075. n
  3076. 0: n
  3077. \= Expect no match
  3078. z
  3079. No match
  3080. /abcde{0,0}/
  3081. abcd
  3082. 0: abcd
  3083. \= Expect no match
  3084. abce
  3085. No match
  3086. /ab[cd]{0,0}e/
  3087. abe
  3088. 0: abe
  3089. \= Expect no match
  3090. abcde
  3091. No match
  3092. /ab(c){0,0}d/
  3093. abd
  3094. 0: abd
  3095. \= Expect no match
  3096. abcd
  3097. No match
  3098. /a(b*)/
  3099. a
  3100. 0: a
  3101. ab
  3102. 0: ab
  3103. abbbb
  3104. 0: abbbb
  3105. \= Expect no match
  3106. bbbbb
  3107. No match
  3108. /ab\d{0}e/
  3109. abe
  3110. 0: abe
  3111. \= Expect no match
  3112. ab1e
  3113. No match
  3114. /"([^\\"]+|\\.)*"/
  3115. the \"quick\" brown fox
  3116. 0: "quick"
  3117. \"the \\\"quick\\\" brown fox\"
  3118. 0: "the \"quick\" brown fox"
  3119. /.*?/g,aftertext
  3120. abc
  3121. 0: abc
  3122. 0+
  3123. 1: ab
  3124. 2: a
  3125. 3:
  3126. 0:
  3127. 0+
  3128. /\b/g,aftertext
  3129. abc
  3130. 0:
  3131. 0+ abc
  3132. 0:
  3133. 0+
  3134. /\b/g,aftertext
  3135. abc
  3136. 0:
  3137. 0+ abc
  3138. 0:
  3139. 0+
  3140. //g
  3141. abc
  3142. 0:
  3143. 0:
  3144. 0:
  3145. 0:
  3146. /<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is
  3147. <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
  3148. 0: <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
  3149. /a[^a]b/
  3150. acb
  3151. 0: acb
  3152. a\nb
  3153. 0: a\x0ab
  3154. /a.b/
  3155. acb
  3156. 0: acb
  3157. \= Expect no match
  3158. a\nb
  3159. No match
  3160. /a[^a]b/s
  3161. acb
  3162. 0: acb
  3163. a\nb
  3164. 0: a\x0ab
  3165. /a.b/s
  3166. acb
  3167. 0: acb
  3168. a\nb
  3169. 0: a\x0ab
  3170. /^(b+?|a){1,2}?c/
  3171. bac
  3172. 0: bac
  3173. bbac
  3174. 0: bbac
  3175. bbbac
  3176. 0: bbbac
  3177. bbbbac
  3178. 0: bbbbac
  3179. bbbbbac
  3180. 0: bbbbbac
  3181. /^(b+|a){1,2}?c/
  3182. bac
  3183. 0: bac
  3184. bbac
  3185. 0: bbac
  3186. bbbac
  3187. 0: bbbac
  3188. bbbbac
  3189. 0: bbbbac
  3190. bbbbbac
  3191. 0: bbbbbac
  3192. /(?!\A)x/m
  3193. a\bx\n
  3194. 0: x
  3195. \= Expect no match
  3196. x\nb\n
  3197. No match
  3198. /\x0{ab}/
  3199. \0{ab}
  3200. 0: \x00{ab}
  3201. /(A|B)*?CD/
  3202. CD
  3203. 0: CD
  3204. /(A|B)*CD/
  3205. CD
  3206. 0: CD
  3207. /(?<!bar)foo/
  3208. foo
  3209. 0: foo
  3210. catfood
  3211. 0: foo
  3212. arfootle
  3213. 0: foo
  3214. rfoosh
  3215. 0: foo
  3216. \= Expect no match
  3217. barfoo
  3218. No match
  3219. towbarfoo
  3220. No match
  3221. /\w{3}(?<!bar)foo/
  3222. catfood
  3223. 0: catfoo
  3224. \= Expect no match
  3225. foo
  3226. No match
  3227. barfoo
  3228. No match
  3229. towbarfoo
  3230. No match
  3231. /(?<=(foo)a)bar/
  3232. fooabar
  3233. 0: bar
  3234. \= Expect no match
  3235. bar
  3236. No match
  3237. foobbar
  3238. No match
  3239. /\Aabc\z/m
  3240. abc
  3241. 0: abc
  3242. \= Expect no match
  3243. abc\n
  3244. No match
  3245. qqq\nabc
  3246. No match
  3247. abc\nzzz
  3248. No match
  3249. qqq\nabc\nzzz
  3250. No match
  3251. "(?>.*/)foo"
  3252. \= Expect no match
  3253. /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
  3254. No match
  3255. "(?>.*/)foo"
  3256. /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
  3257. 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
  3258. /(?>(\.\d\d[1-9]?))\d+/
  3259. 1.230003938
  3260. 0: .230003938
  3261. 1.875000282
  3262. 0: .875000282
  3263. \= Expect no match
  3264. 1.235
  3265. No match
  3266. /^((?>\w+)|(?>\s+))*$/
  3267. now is the time for all good men to come to the aid of the party
  3268. 0: now is the time for all good men to come to the aid of the party
  3269. \= Expect no match
  3270. this is not a line with only words and spaces!
  3271. No match
  3272. /(\d+)(\w)/
  3273. 12345a
  3274. 0: 12345a
  3275. 1: 12345
  3276. 2: 1234
  3277. 3: 123
  3278. 4: 12
  3279. 12345+
  3280. 0: 12345
  3281. 1: 1234
  3282. 2: 123
  3283. 3: 12
  3284. /((?>\d+))(\w)/
  3285. 12345a
  3286. 0: 12345a
  3287. \= Expect no match
  3288. 12345+
  3289. No match
  3290. /(?>a+)b/
  3291. aaab
  3292. 0: aaab
  3293. /((?>a+)b)/
  3294. aaab
  3295. 0: aaab
  3296. /(?>(a+))b/
  3297. aaab
  3298. 0: aaab
  3299. /(?>b)+/
  3300. aaabbbccc
  3301. 0: bbb
  3302. 1: bb
  3303. 2: b
  3304. /(?>a+|b+|c+)*c/
  3305. aaabbbbccccd
  3306. 0: aaabbbbcccc
  3307. 1: aaabbbbc
  3308. /(a+|b+|c+)*c/
  3309. aaabbbbccccd
  3310. 0: aaabbbbcccc
  3311. 1: aaabbbbccc
  3312. 2: aaabbbbcc
  3313. 3: aaabbbbc
  3314. /((?>[^()]+)|\([^()]*\))+/
  3315. ((abc(ade)ufh()()x
  3316. 0: abc(ade)ufh()()x
  3317. 1: abc(ade)ufh()()
  3318. 2: abc(ade)ufh()
  3319. 3: abc(ade)ufh
  3320. 4: abc(ade)
  3321. 5: abc
  3322. /\(((?>[^()]+)|\([^()]+\))+\)/
  3323. (abc)
  3324. 0: (abc)
  3325. (abc(def)xyz)
  3326. 0: (abc(def)xyz)
  3327. \= Expect no match
  3328. ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  3329. No match
  3330. /a(?-i)b/i
  3331. ab
  3332. 0: ab
  3333. Ab
  3334. 0: Ab
  3335. \= Expect no match
  3336. aB
  3337. No match
  3338. AB
  3339. No match
  3340. /(a (?x)b c)d e/
  3341. a bcd e
  3342. 0: a bcd e
  3343. \= Expect no match
  3344. a b cd e
  3345. No match
  3346. abcd e
  3347. No match
  3348. a bcde
  3349. No match
  3350. /(a b(?x)c d (?-x)e f)/
  3351. a bcde f
  3352. 0: a bcde f
  3353. \= Expect no match
  3354. abcdef
  3355. No match
  3356. /(a(?i)b)c/
  3357. abc
  3358. 0: abc
  3359. aBc
  3360. 0: aBc
  3361. \= Expect no match
  3362. abC
  3363. No match
  3364. aBC
  3365. No match
  3366. Abc
  3367. No match
  3368. ABc
  3369. No match
  3370. ABC
  3371. No match
  3372. AbC
  3373. No match
  3374. /a(?i:b)c/
  3375. abc
  3376. 0: abc
  3377. aBc
  3378. 0: aBc
  3379. \= Expect no match
  3380. ABC
  3381. No match
  3382. abC
  3383. No match
  3384. aBC
  3385. No match
  3386. /a(?i:b)*c/
  3387. aBc
  3388. 0: aBc
  3389. aBBc
  3390. 0: aBBc
  3391. \= Expect no match
  3392. aBC
  3393. No match
  3394. aBBC
  3395. No match
  3396. /a(?=b(?i)c)\w\wd/
  3397. abcd
  3398. 0: abcd
  3399. abCd
  3400. 0: abCd
  3401. \= Expect no match
  3402. aBCd
  3403. No match
  3404. abcD
  3405. No match
  3406. /(?s-i:more.*than).*million/i
  3407. more than million
  3408. 0: more than million
  3409. more than MILLION
  3410. 0: more than MILLION
  3411. more \n than Million
  3412. 0: more \x0a than Million
  3413. \= Expect no match
  3414. MORE THAN MILLION
  3415. No match
  3416. more \n than \n million
  3417. No match
  3418. /(?:(?s-i)more.*than).*million/i
  3419. more than million
  3420. 0: more than million
  3421. more than MILLION
  3422. 0: more than MILLION
  3423. more \n than Million
  3424. 0: more \x0a than Million
  3425. \= Expect no match
  3426. MORE THAN MILLION
  3427. No match
  3428. more \n than \n million
  3429. No match
  3430. /(?>a(?i)b+)+c/
  3431. abc
  3432. 0: abc
  3433. aBbc
  3434. 0: aBbc
  3435. aBBc
  3436. 0: aBBc
  3437. \= Expect no match
  3438. Abc
  3439. No match
  3440. abAb
  3441. No match
  3442. abbC
  3443. No match
  3444. /(?=a(?i)b)\w\wc/
  3445. abc
  3446. 0: abc
  3447. aBc
  3448. 0: aBc
  3449. \= Expect no match
  3450. Ab
  3451. No match
  3452. abC
  3453. No match
  3454. aBC
  3455. No match
  3456. /(?<=a(?i)b)(\w\w)c/
  3457. abxxc
  3458. 0: xxc
  3459. aBxxc
  3460. 0: xxc
  3461. \= Expect no match
  3462. Abxxc
  3463. No match
  3464. ABxxc
  3465. No match
  3466. abxxC
  3467. No match
  3468. /^(?(?=abc)\w{3}:|\d\d)$/
  3469. abc:
  3470. 0: abc:
  3471. 12
  3472. 0: 12
  3473. \= Expect no match
  3474. 123
  3475. No match
  3476. xyz
  3477. No match
  3478. /^(?(?!abc)\d\d|\w{3}:)$/
  3479. abc:
  3480. 0: abc:
  3481. 12
  3482. 0: 12
  3483. \= Expect no match
  3484. 123
  3485. No match
  3486. xyz
  3487. No match
  3488. /(?(?<=foo)bar|cat)/
  3489. foobar
  3490. 0: bar
  3491. cat
  3492. 0: cat
  3493. fcat
  3494. 0: cat
  3495. focat
  3496. 0: cat
  3497. \= Expect no match
  3498. foocat
  3499. No match
  3500. /(?(?<!foo)cat|bar)/
  3501. foobar
  3502. 0: bar
  3503. cat
  3504. 0: cat
  3505. fcat
  3506. 0: cat
  3507. focat
  3508. 0: cat
  3509. \= Expect no match
  3510. foocat
  3511. No match
  3512. /(?>a*)*/
  3513. a
  3514. 0: a
  3515. 1:
  3516. aa
  3517. 0: aa
  3518. 1:
  3519. aaaa
  3520. 0: aaaa
  3521. 1:
  3522. /(abc|)+/
  3523. abc
  3524. 0: abc
  3525. 1:
  3526. abcabc
  3527. 0: abcabc
  3528. 1: abc
  3529. 2:
  3530. abcabcabc
  3531. 0: abcabcabc
  3532. 1: abcabc
  3533. 2: abc
  3534. 3:
  3535. xyz
  3536. 0:
  3537. /([a]*)*/
  3538. a
  3539. 0: a
  3540. 1:
  3541. aaaaa
  3542. 0: aaaaa
  3543. 1: aaaa
  3544. 2: aaa
  3545. 3: aa
  3546. 4: a
  3547. 5:
  3548. /([ab]*)*/
  3549. a
  3550. 0: a
  3551. 1:
  3552. b
  3553. 0: b
  3554. 1:
  3555. ababab
  3556. 0: ababab
  3557. 1: ababa
  3558. 2: abab
  3559. 3: aba
  3560. 4: ab
  3561. 5: a
  3562. 6:
  3563. aaaabcde
  3564. 0: aaaab
  3565. 1: aaaa
  3566. 2: aaa
  3567. 3: aa
  3568. 4: a
  3569. 5:
  3570. bbbb
  3571. 0: bbbb
  3572. 1: bbb
  3573. 2: bb
  3574. 3: b
  3575. 4:
  3576. /([^a]*)*/
  3577. b
  3578. 0: b
  3579. 1:
  3580. bbbb
  3581. 0: bbbb
  3582. 1: bbb
  3583. 2: bb
  3584. 3: b
  3585. 4:
  3586. aaa
  3587. 0:
  3588. /([^ab]*)*/
  3589. cccc
  3590. 0: cccc
  3591. 1: ccc
  3592. 2: cc
  3593. 3: c
  3594. 4:
  3595. abab
  3596. 0:
  3597. /([a]*?)*/
  3598. a
  3599. 0: a
  3600. 1:
  3601. aaaa
  3602. 0: aaaa
  3603. 1: aaa
  3604. 2: aa
  3605. 3: a
  3606. 4:
  3607. /([ab]*?)*/
  3608. a
  3609. 0: a
  3610. 1:
  3611. b
  3612. 0: b
  3613. 1:
  3614. abab
  3615. 0: abab
  3616. 1: aba
  3617. 2: ab
  3618. 3: a
  3619. 4:
  3620. baba
  3621. 0: baba
  3622. 1: bab
  3623. 2: ba
  3624. 3: b
  3625. 4:
  3626. /([^a]*?)*/
  3627. b
  3628. 0: b
  3629. 1:
  3630. bbbb
  3631. 0: bbbb
  3632. 1: bbb
  3633. 2: bb
  3634. 3: b
  3635. 4:
  3636. aaa
  3637. 0:
  3638. /([^ab]*?)*/
  3639. c
  3640. 0: c
  3641. 1:
  3642. cccc
  3643. 0: cccc
  3644. 1: ccc
  3645. 2: cc
  3646. 3: c
  3647. 4:
  3648. baba
  3649. 0:
  3650. /(?>a*)*/
  3651. a
  3652. 0: a
  3653. 1:
  3654. aaabcde
  3655. 0: aaa
  3656. 1:
  3657. /((?>a*))*/
  3658. aaaaa
  3659. 0: aaaaa
  3660. 1:
  3661. aabbaa
  3662. 0: aa
  3663. 1:
  3664. /((?>a*?))*/
  3665. aaaaa
  3666. 0: aaaaa
  3667. 1:
  3668. aabbaa
  3669. 0: aa
  3670. 1:
  3671. /(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x
  3672. 12-sep-98
  3673. 0: 12-sep-98
  3674. 12-09-98
  3675. 0: 12-09-98
  3676. \= Expect no match
  3677. sep-12-98
  3678. No match
  3679. /(?i:saturday|sunday)/
  3680. saturday
  3681. 0: saturday
  3682. sunday
  3683. 0: sunday
  3684. Saturday
  3685. 0: Saturday
  3686. Sunday
  3687. 0: Sunday
  3688. SATURDAY
  3689. 0: SATURDAY
  3690. SUNDAY
  3691. 0: SUNDAY
  3692. SunDay
  3693. 0: SunDay
  3694. /(a(?i)bc|BB)x/
  3695. abcx
  3696. 0: abcx
  3697. aBCx
  3698. 0: aBCx
  3699. bbx
  3700. 0: bbx
  3701. BBx
  3702. 0: BBx
  3703. \= Expect no match
  3704. abcX
  3705. No match
  3706. aBCX
  3707. No match
  3708. bbX
  3709. No match
  3710. BBX
  3711. No match
  3712. /^([ab](?i)[cd]|[ef])/
  3713. ac
  3714. 0: ac
  3715. aC
  3716. 0: aC
  3717. bD
  3718. 0: bD
  3719. elephant
  3720. 0: e
  3721. Europe
  3722. 0: E
  3723. frog
  3724. 0: f
  3725. France
  3726. 0: F
  3727. \= Expect no match
  3728. Africa
  3729. No match
  3730. /^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
  3731. ab
  3732. 0: ab
  3733. aBd
  3734. 0: aBd
  3735. xy
  3736. 0: xy
  3737. xY
  3738. 0: xY
  3739. zebra
  3740. 0: z
  3741. Zambesi
  3742. 0: Z
  3743. \= Expect no match
  3744. aCD
  3745. No match
  3746. XY
  3747. No match
  3748. /(?<=foo\n)^bar/m
  3749. foo\nbar
  3750. 0: bar
  3751. \= Expect no match
  3752. bar
  3753. No match
  3754. baz\nbar
  3755. No match
  3756. /(?<=(?<!foo)bar)baz/
  3757. barbaz
  3758. 0: baz
  3759. barbarbaz
  3760. 0: baz
  3761. koobarbaz
  3762. 0: baz
  3763. \= Expect no match
  3764. baz
  3765. No match
  3766. foobarbaz
  3767. No match
  3768. # The following tests are taken from the Perl 5.005 test suite; some of them
  3769. # are compatible with 5.004, but I'd rather not have to sort them out.
  3770. /abc/
  3771. abc
  3772. 0: abc
  3773. xabcy
  3774. 0: abc
  3775. ababc
  3776. 0: abc
  3777. \= Expect no match
  3778. xbc
  3779. No match
  3780. axc
  3781. No match
  3782. abx
  3783. No match
  3784. /ab*c/
  3785. abc
  3786. 0: abc
  3787. /ab*bc/
  3788. abc
  3789. 0: abc
  3790. abbc
  3791. 0: abbc
  3792. abbbbc
  3793. 0: abbbbc
  3794. /.{1}/
  3795. abbbbc
  3796. 0: a
  3797. /.{3,4}/
  3798. abbbbc
  3799. 0: abbb
  3800. /ab{0,}bc/
  3801. abbbbc
  3802. 0: abbbbc
  3803. /ab+bc/
  3804. abbc
  3805. 0: abbc
  3806. \= Expect no match
  3807. abc
  3808. No match
  3809. abq
  3810. No match
  3811. /ab+bc/
  3812. abbbbc
  3813. 0: abbbbc
  3814. /ab{1,}bc/
  3815. abbbbc
  3816. 0: abbbbc
  3817. /ab{1,3}bc/
  3818. abbbbc
  3819. 0: abbbbc
  3820. /ab{3,4}bc/
  3821. abbbbc
  3822. 0: abbbbc
  3823. /ab{4,5}bc/
  3824. \= Expect no match
  3825. abq
  3826. No match
  3827. abbbbc
  3828. No match
  3829. /ab?bc/
  3830. abbc
  3831. 0: abbc
  3832. abc
  3833. 0: abc
  3834. /ab{0,1}bc/
  3835. abc
  3836. 0: abc
  3837. /ab?bc/
  3838. /ab?c/
  3839. abc
  3840. 0: abc
  3841. /ab{0,1}c/
  3842. abc
  3843. 0: abc
  3844. /^abc$/
  3845. abc
  3846. 0: abc
  3847. \= Expect no match
  3848. abbbbc
  3849. No match
  3850. abcc
  3851. No match
  3852. /^abc/
  3853. abcc
  3854. 0: abc
  3855. /^abc$/
  3856. /abc$/
  3857. aabc
  3858. 0: abc
  3859. aabc
  3860. 0: abc
  3861. \= Expect no match
  3862. aabcd
  3863. No match
  3864. /^/
  3865. abc
  3866. 0:
  3867. /$/
  3868. abc
  3869. 0:
  3870. /a.c/
  3871. abc
  3872. 0: abc
  3873. axc
  3874. 0: axc
  3875. /a.*c/
  3876. axyzc
  3877. 0: axyzc
  3878. /a[bc]d/
  3879. abd
  3880. 0: abd
  3881. \= Expect no match
  3882. axyzd
  3883. No match
  3884. abc
  3885. No match
  3886. /a[b-d]e/
  3887. ace
  3888. 0: ace
  3889. /a[b-d]/
  3890. aac
  3891. 0: ac
  3892. /a[-b]/
  3893. a-
  3894. 0: a-
  3895. /a[b-]/
  3896. a-
  3897. 0: a-
  3898. /a]/
  3899. a]
  3900. 0: a]
  3901. /a[]]b/
  3902. a]b
  3903. 0: a]b
  3904. /a[^bc]d/
  3905. aed
  3906. 0: aed
  3907. \= Expect no match
  3908. abd
  3909. No match
  3910. abd
  3911. No match
  3912. /a[^-b]c/
  3913. adc
  3914. 0: adc
  3915. /a[^]b]c/
  3916. adc
  3917. 0: adc
  3918. a-c
  3919. 0: a-c
  3920. \= Expect no match
  3921. a]c
  3922. No match
  3923. /\ba\b/
  3924. a-
  3925. 0: a
  3926. -a
  3927. 0: a
  3928. -a-
  3929. 0: a
  3930. /\by\b/
  3931. \= Expect no match
  3932. xy
  3933. No match
  3934. yz
  3935. No match
  3936. xyz
  3937. No match
  3938. /\Ba\B/
  3939. \= Expect no match
  3940. a-
  3941. No match
  3942. -a
  3943. No match
  3944. -a-
  3945. No match
  3946. /\By\b/
  3947. xy
  3948. 0: y
  3949. /\by\B/
  3950. yz
  3951. 0: y
  3952. /\By\B/
  3953. xyz
  3954. 0: y
  3955. /\w/
  3956. a
  3957. 0: a
  3958. /\W/
  3959. -
  3960. 0: -
  3961. \= Expect no match
  3962. a
  3963. No match
  3964. /a\sb/
  3965. a b
  3966. 0: a b
  3967. /a\Sb/
  3968. a-b
  3969. 0: a-b
  3970. \= Expect no match
  3971. a b
  3972. No match
  3973. /\d/
  3974. 1
  3975. 0: 1
  3976. /\D/
  3977. -
  3978. 0: -
  3979. \= Expect no match
  3980. 1
  3981. No match
  3982. /[\w]/
  3983. a
  3984. 0: a
  3985. /[\W]/
  3986. -
  3987. 0: -
  3988. \= Expect no match
  3989. a
  3990. No match
  3991. /a[\s]b/
  3992. a b
  3993. 0: a b
  3994. /a[\S]b/
  3995. a-b
  3996. 0: a-b
  3997. \= Expect no match
  3998. a b
  3999. No match
  4000. /[\d]/
  4001. 1
  4002. 0: 1
  4003. /[\D]/
  4004. -
  4005. 0: -
  4006. \= Expect no match
  4007. 1
  4008. No match
  4009. /ab|cd/
  4010. abc
  4011. 0: ab
  4012. abcd
  4013. 0: ab
  4014. /()ef/
  4015. def
  4016. 0: ef
  4017. /$b/
  4018. /a\(b/
  4019. a(b
  4020. 0: a(b
  4021. /a\(*b/
  4022. ab
  4023. 0: ab
  4024. a((b
  4025. 0: a((b
  4026. /a\\b/
  4027. a\\b
  4028. 0: a\b
  4029. \= Expect no match
  4030. a\b
  4031. No match
  4032. /((a))/
  4033. abc
  4034. 0: a
  4035. /(a)b(c)/
  4036. abc
  4037. 0: abc
  4038. /a+b+c/
  4039. aabbabc
  4040. 0: abc
  4041. /a{1,}b{1,}c/
  4042. aabbabc
  4043. 0: abc
  4044. /a.+?c/
  4045. abcabc
  4046. 0: abcabc
  4047. 1: abc
  4048. /(a+|b)*/
  4049. ab
  4050. 0: ab
  4051. 1: a
  4052. 2:
  4053. /(a+|b){0,}/
  4054. ab
  4055. 0: ab
  4056. 1: a
  4057. 2:
  4058. /(a+|b)+/
  4059. ab
  4060. 0: ab
  4061. 1: a
  4062. /(a+|b){1,}/
  4063. ab
  4064. 0: ab
  4065. 1: a
  4066. /(a+|b)?/
  4067. ab
  4068. 0: a
  4069. 1:
  4070. /(a+|b){0,1}/
  4071. ab
  4072. 0: a
  4073. 1:
  4074. /[^ab]*/
  4075. cde
  4076. 0: cde
  4077. /abc/
  4078. \= Expect no match
  4079. b
  4080. No match
  4081. /a*/
  4082. /([abc])*d/
  4083. abbbcd
  4084. 0: abbbcd
  4085. /([abc])*bcd/
  4086. abcd
  4087. 0: abcd
  4088. /a|b|c|d|e/
  4089. e
  4090. 0: e
  4091. /(a|b|c|d|e)f/
  4092. ef
  4093. 0: ef
  4094. /abcd*efg/
  4095. abcdefg
  4096. 0: abcdefg
  4097. /ab*/
  4098. xabyabbbz
  4099. 0: ab
  4100. xayabbbz
  4101. 0: a
  4102. /(ab|cd)e/
  4103. abcde
  4104. 0: cde
  4105. /[abhgefdc]ij/
  4106. hij
  4107. 0: hij
  4108. /^(ab|cd)e/
  4109. /(abc|)ef/
  4110. abcdef
  4111. 0: ef
  4112. /(a|b)c*d/
  4113. abcd
  4114. 0: bcd
  4115. /(ab|ab*)bc/
  4116. abc
  4117. 0: abc
  4118. /a([bc]*)c*/
  4119. abc
  4120. 0: abc
  4121. 1: a
  4122. /a([bc]*)(c*d)/
  4123. abcd
  4124. 0: abcd
  4125. /a([bc]+)(c*d)/
  4126. abcd
  4127. 0: abcd
  4128. /a([bc]*)(c+d)/
  4129. abcd
  4130. 0: abcd
  4131. /a[bcd]*dcdcde/
  4132. adcdcde
  4133. 0: adcdcde
  4134. /a[bcd]+dcdcde/
  4135. \= Expect no match
  4136. abcde
  4137. No match
  4138. adcdcde
  4139. No match
  4140. /(ab|a)b*c/
  4141. abc
  4142. 0: abc
  4143. /((a)(b)c)(d)/
  4144. abcd
  4145. 0: abcd
  4146. /[a-zA-Z_][a-zA-Z0-9_]*/
  4147. alpha
  4148. 0: alpha
  4149. /^a(bc+|b[eh])g|.h$/
  4150. abh
  4151. 0: bh
  4152. /(bc+d$|ef*g.|h?i(j|k))/
  4153. effgz
  4154. 0: effgz
  4155. ij
  4156. 0: ij
  4157. reffgz
  4158. 0: effgz
  4159. \= Expect no match
  4160. effg
  4161. No match
  4162. bcdd
  4163. No match
  4164. /((((((((((a))))))))))/
  4165. a
  4166. 0: a
  4167. /(((((((((a)))))))))/
  4168. a
  4169. 0: a
  4170. /multiple words of text/
  4171. \= Expect no match
  4172. aa
  4173. No match
  4174. uh-uh
  4175. No match
  4176. /multiple words/
  4177. multiple words, yeah
  4178. 0: multiple words
  4179. /(.*)c(.*)/
  4180. abcde
  4181. 0: abcde
  4182. /\((.*), (.*)\)/
  4183. (a, b)
  4184. 0: (a, b)
  4185. /[k]/
  4186. /abcd/
  4187. abcd
  4188. 0: abcd
  4189. /a(bc)d/
  4190. abcd
  4191. 0: abcd
  4192. /a[-]?c/
  4193. ac
  4194. 0: ac
  4195. /abc/i
  4196. ABC
  4197. 0: ABC
  4198. XABCY
  4199. 0: ABC
  4200. ABABC
  4201. 0: ABC
  4202. \= Expect no match
  4203. aaxabxbaxbbx
  4204. No match
  4205. XBC
  4206. No match
  4207. AXC
  4208. No match
  4209. ABX
  4210. No match
  4211. /ab*c/i
  4212. ABC
  4213. 0: ABC
  4214. /ab*bc/i
  4215. ABC
  4216. 0: ABC
  4217. ABBC
  4218. 0: ABBC
  4219. /ab*?bc/i
  4220. ABBBBC
  4221. 0: ABBBBC
  4222. /ab{0,}?bc/i
  4223. ABBBBC
  4224. 0: ABBBBC
  4225. /ab+?bc/i
  4226. ABBC
  4227. 0: ABBC
  4228. /ab+bc/i
  4229. \= Expect no match
  4230. ABC
  4231. No match
  4232. ABQ
  4233. No match
  4234. /ab{1,}bc/i
  4235. /ab+bc/i
  4236. ABBBBC
  4237. 0: ABBBBC
  4238. /ab{1,}?bc/i
  4239. ABBBBC
  4240. 0: ABBBBC
  4241. /ab{1,3}?bc/i
  4242. ABBBBC
  4243. 0: ABBBBC
  4244. /ab{3,4}?bc/i
  4245. ABBBBC
  4246. 0: ABBBBC
  4247. /ab{4,5}?bc/i
  4248. \= Expect no match
  4249. ABQ
  4250. No match
  4251. ABBBBC
  4252. No match
  4253. /ab??bc/i
  4254. ABBC
  4255. 0: ABBC
  4256. ABC
  4257. 0: ABC
  4258. /ab{0,1}?bc/i
  4259. ABC
  4260. 0: ABC
  4261. /ab??bc/i
  4262. /ab??c/i
  4263. ABC
  4264. 0: ABC
  4265. /ab{0,1}?c/i
  4266. ABC
  4267. 0: ABC
  4268. /^abc$/i
  4269. ABC
  4270. 0: ABC
  4271. \= Expect no match
  4272. ABBBBC
  4273. No match
  4274. ABCC
  4275. No match
  4276. /^abc/i
  4277. ABCC
  4278. 0: ABC
  4279. /^abc$/i
  4280. /abc$/i
  4281. AABC
  4282. 0: ABC
  4283. /^/i
  4284. ABC
  4285. 0:
  4286. /$/i
  4287. ABC
  4288. 0:
  4289. /a.c/i
  4290. ABC
  4291. 0: ABC
  4292. AXC
  4293. 0: AXC
  4294. /a.*?c/i
  4295. AXYZC
  4296. 0: AXYZC
  4297. /a.*c/i
  4298. AABC
  4299. 0: AABC
  4300. \= Expect no match
  4301. AXYZD
  4302. No match
  4303. /a[bc]d/i
  4304. ABD
  4305. 0: ABD
  4306. /a[b-d]e/i
  4307. ACE
  4308. 0: ACE
  4309. \= Expect no match
  4310. ABC
  4311. No match
  4312. ABD
  4313. No match
  4314. /a[b-d]/i
  4315. AAC
  4316. 0: AC
  4317. /a[-b]/i
  4318. A-
  4319. 0: A-
  4320. /a[b-]/i
  4321. A-
  4322. 0: A-
  4323. /a]/i
  4324. A]
  4325. 0: A]
  4326. /a[]]b/i
  4327. A]B
  4328. 0: A]B
  4329. /a[^bc]d/i
  4330. AED
  4331. 0: AED
  4332. /a[^-b]c/i
  4333. ADC
  4334. 0: ADC
  4335. \= Expect no match
  4336. ABD
  4337. No match
  4338. A-C
  4339. No match
  4340. /a[^]b]c/i
  4341. ADC
  4342. 0: ADC
  4343. /ab|cd/i
  4344. ABC
  4345. 0: AB
  4346. ABCD
  4347. 0: AB
  4348. /()ef/i
  4349. DEF
  4350. 0: EF
  4351. /$b/i
  4352. \= Expect no match
  4353. A]C
  4354. No match
  4355. B
  4356. No match
  4357. /a\(b/i
  4358. A(B
  4359. 0: A(B
  4360. /a\(*b/i
  4361. AB
  4362. 0: AB
  4363. A((B
  4364. 0: A((B
  4365. /a\\b/i
  4366. \= Expect no match
  4367. A\=notbol
  4368. No match
  4369. /((a))/i
  4370. ABC
  4371. 0: A
  4372. /(a)b(c)/i
  4373. ABC
  4374. 0: ABC
  4375. /a+b+c/i
  4376. AABBABC
  4377. 0: ABC
  4378. /a{1,}b{1,}c/i
  4379. AABBABC
  4380. 0: ABC
  4381. /a.+?c/i
  4382. ABCABC
  4383. 0: ABCABC
  4384. 1: ABC
  4385. /a.*?c/i
  4386. ABCABC
  4387. 0: ABCABC
  4388. 1: ABC
  4389. /a.{0,5}?c/i
  4390. ABCABC
  4391. 0: ABCABC
  4392. 1: ABC
  4393. /(a+|b)*/i
  4394. AB
  4395. 0: AB
  4396. 1: A
  4397. 2:
  4398. /(a+|b){0,}/i
  4399. AB
  4400. 0: AB
  4401. 1: A
  4402. 2:
  4403. /(a+|b)+/i
  4404. AB
  4405. 0: AB
  4406. 1: A
  4407. /(a+|b){1,}/i
  4408. AB
  4409. 0: AB
  4410. 1: A
  4411. /(a+|b)?/i
  4412. AB
  4413. 0: A
  4414. 1:
  4415. /(a+|b){0,1}/i
  4416. AB
  4417. 0: A
  4418. 1:
  4419. /(a+|b){0,1}?/i
  4420. AB
  4421. 0: A
  4422. 1:
  4423. /[^ab]*/i
  4424. CDE
  4425. 0: CDE
  4426. /abc/i
  4427. /a*/i
  4428. /([abc])*d/i
  4429. ABBBCD
  4430. 0: ABBBCD
  4431. /([abc])*bcd/i
  4432. ABCD
  4433. 0: ABCD
  4434. /a|b|c|d|e/i
  4435. E
  4436. 0: E
  4437. /(a|b|c|d|e)f/i
  4438. EF
  4439. 0: EF
  4440. /abcd*efg/i
  4441. ABCDEFG
  4442. 0: ABCDEFG
  4443. /ab*/i
  4444. XABYABBBZ
  4445. 0: AB
  4446. XAYABBBZ
  4447. 0: A
  4448. /(ab|cd)e/i
  4449. ABCDE
  4450. 0: CDE
  4451. /[abhgefdc]ij/i
  4452. HIJ
  4453. 0: HIJ
  4454. /^(ab|cd)e/i
  4455. \= Expect no match
  4456. ABCDE
  4457. No match
  4458. /(abc|)ef/i
  4459. ABCDEF
  4460. 0: EF
  4461. /(a|b)c*d/i
  4462. ABCD
  4463. 0: BCD
  4464. /(ab|ab*)bc/i
  4465. ABC
  4466. 0: ABC
  4467. /a([bc]*)c*/i
  4468. ABC
  4469. 0: ABC
  4470. 1: A
  4471. /a([bc]*)(c*d)/i
  4472. ABCD
  4473. 0: ABCD
  4474. /a([bc]+)(c*d)/i
  4475. ABCD
  4476. 0: ABCD
  4477. /a([bc]*)(c+d)/i
  4478. ABCD
  4479. 0: ABCD
  4480. /a[bcd]*dcdcde/i
  4481. ADCDCDE
  4482. 0: ADCDCDE
  4483. /a[bcd]+dcdcde/i
  4484. /(ab|a)b*c/i
  4485. ABC
  4486. 0: ABC
  4487. /((a)(b)c)(d)/i
  4488. ABCD
  4489. 0: ABCD
  4490. /[a-zA-Z_][a-zA-Z0-9_]*/i
  4491. ALPHA
  4492. 0: ALPHA
  4493. /^a(bc+|b[eh])g|.h$/i
  4494. ABH
  4495. 0: BH
  4496. /(bc+d$|ef*g.|h?i(j|k))/i
  4497. EFFGZ
  4498. 0: EFFGZ
  4499. IJ
  4500. 0: IJ
  4501. REFFGZ
  4502. 0: EFFGZ
  4503. \= Expect no match
  4504. ADCDCDE
  4505. No match
  4506. EFFG
  4507. No match
  4508. BCDD
  4509. No match
  4510. /((((((((((a))))))))))/i
  4511. A
  4512. 0: A
  4513. /(((((((((a)))))))))/i
  4514. A
  4515. 0: A
  4516. /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
  4517. A
  4518. 0: A
  4519. /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
  4520. C
  4521. 0: C
  4522. /multiple words of text/i
  4523. \= Expect no match
  4524. AA
  4525. No match
  4526. UH-UH
  4527. No match
  4528. /multiple words/i
  4529. MULTIPLE WORDS, YEAH
  4530. 0: MULTIPLE WORDS
  4531. /(.*)c(.*)/i
  4532. ABCDE
  4533. 0: ABCDE
  4534. /\((.*), (.*)\)/i
  4535. (A, B)
  4536. 0: (A, B)
  4537. /[k]/i
  4538. /abcd/i
  4539. ABCD
  4540. 0: ABCD
  4541. /a(bc)d/i
  4542. ABCD
  4543. 0: ABCD
  4544. /a[-]?c/i
  4545. AC
  4546. 0: AC
  4547. /a(?!b)./
  4548. abad
  4549. 0: ad
  4550. /a(?=d)./
  4551. abad
  4552. 0: ad
  4553. /a(?=c|d)./
  4554. abad
  4555. 0: ad
  4556. /a(?:b|c|d)(.)/
  4557. ace
  4558. 0: ace
  4559. /a(?:b|c|d)*(.)/
  4560. ace
  4561. 0: ace
  4562. 1: ac
  4563. /a(?:b|c|d)+?(.)/
  4564. ace
  4565. 0: ace
  4566. acdbcdbe
  4567. 0: acdbcdbe
  4568. 1: acdbcdb
  4569. 2: acdbcd
  4570. 3: acdbc
  4571. 4: acdb
  4572. 5: acd
  4573. /a(?:b|c|d)+(.)/
  4574. acdbcdbe
  4575. 0: acdbcdbe
  4576. 1: acdbcdb
  4577. 2: acdbcd
  4578. 3: acdbc
  4579. 4: acdb
  4580. 5: acd
  4581. /a(?:b|c|d){2}(.)/
  4582. acdbcdbe
  4583. 0: acdb
  4584. /a(?:b|c|d){4,5}(.)/
  4585. acdbcdbe
  4586. 0: acdbcdb
  4587. 1: acdbcd
  4588. /a(?:b|c|d){4,5}?(.)/
  4589. acdbcdbe
  4590. 0: acdbcdb
  4591. 1: acdbcd
  4592. /((foo)|(bar))*/
  4593. foobar
  4594. 0: foobar
  4595. 1: foo
  4596. 2:
  4597. /a(?:b|c|d){6,7}(.)/
  4598. acdbcdbe
  4599. 0: acdbcdbe
  4600. /a(?:b|c|d){6,7}?(.)/
  4601. acdbcdbe
  4602. 0: acdbcdbe
  4603. /a(?:b|c|d){5,6}(.)/
  4604. acdbcdbe
  4605. 0: acdbcdbe
  4606. 1: acdbcdb
  4607. /a(?:b|c|d){5,6}?(.)/
  4608. acdbcdbe
  4609. 0: acdbcdbe
  4610. 1: acdbcdb
  4611. /a(?:b|c|d){5,7}(.)/
  4612. acdbcdbe
  4613. 0: acdbcdbe
  4614. 1: acdbcdb
  4615. /a(?:b|c|d){5,7}?(.)/
  4616. acdbcdbe
  4617. 0: acdbcdbe
  4618. 1: acdbcdb
  4619. /a(?:b|(c|e){1,2}?|d)+?(.)/
  4620. ace
  4621. 0: ace
  4622. /^(.+)?B/
  4623. AB
  4624. 0: AB
  4625. /^([^a-z])|(\^)$/
  4626. .
  4627. 0: .
  4628. /^[<>]&/
  4629. <&OUT
  4630. 0: <&
  4631. /(?:(f)(o)(o)|(b)(a)(r))*/
  4632. foobar
  4633. 0: foobar
  4634. 1: foo
  4635. 2:
  4636. /(?<=a)b/
  4637. ab
  4638. 0: b
  4639. \= Expect no match
  4640. cb
  4641. No match
  4642. b
  4643. No match
  4644. /(?<!c)b/
  4645. ab
  4646. 0: b
  4647. b
  4648. 0: b
  4649. b
  4650. 0: b
  4651. /(?:..)*a/
  4652. aba
  4653. 0: aba
  4654. 1: a
  4655. /(?:..)*?a/
  4656. aba
  4657. 0: aba
  4658. 1: a
  4659. /^(){3,5}/
  4660. abc
  4661. 0:
  4662. /^(a+)*ax/
  4663. aax
  4664. 0: aax
  4665. /^((a|b)+)*ax/
  4666. aax
  4667. 0: aax
  4668. /^((a|bc)+)*ax/
  4669. aax
  4670. 0: aax
  4671. /(a|x)*ab/
  4672. cab
  4673. 0: ab
  4674. /(a)*ab/
  4675. cab
  4676. 0: ab
  4677. /(?:(?i)a)b/
  4678. ab
  4679. 0: ab
  4680. /((?i)a)b/
  4681. ab
  4682. 0: ab
  4683. /(?:(?i)a)b/
  4684. Ab
  4685. 0: Ab
  4686. /((?i)a)b/
  4687. Ab
  4688. 0: Ab
  4689. /(?:(?i)a)b/
  4690. \= Expect no match
  4691. cb
  4692. No match
  4693. aB
  4694. No match
  4695. /((?i)a)b/
  4696. /(?i:a)b/
  4697. ab
  4698. 0: ab
  4699. /((?i:a))b/
  4700. ab
  4701. 0: ab
  4702. /(?i:a)b/
  4703. Ab
  4704. 0: Ab
  4705. /((?i:a))b/
  4706. Ab
  4707. 0: Ab
  4708. /(?i:a)b/
  4709. \= Expect no match
  4710. aB
  4711. No match
  4712. aB
  4713. No match
  4714. /((?i:a))b/
  4715. /(?:(?-i)a)b/i
  4716. ab
  4717. 0: ab
  4718. /((?-i)a)b/i
  4719. ab
  4720. 0: ab
  4721. /(?:(?-i)a)b/i
  4722. aB
  4723. 0: aB
  4724. /((?-i)a)b/i
  4725. aB
  4726. 0: aB
  4727. /(?:(?-i)a)b/i
  4728. aB
  4729. 0: aB
  4730. \= Expect no match
  4731. Ab
  4732. No match
  4733. /((?-i)a)b/i
  4734. /(?:(?-i)a)b/i
  4735. aB
  4736. 0: aB
  4737. /((?-i)a)b/i
  4738. aB
  4739. 0: aB
  4740. /(?:(?-i)a)b/i
  4741. \= Expect no match
  4742. Ab
  4743. No match
  4744. AB
  4745. No match
  4746. /((?-i)a)b/i
  4747. /(?-i:a)b/i
  4748. ab
  4749. 0: ab
  4750. /((?-i:a))b/i
  4751. ab
  4752. 0: ab
  4753. /(?-i:a)b/i
  4754. aB
  4755. 0: aB
  4756. /((?-i:a))b/i
  4757. aB
  4758. 0: aB
  4759. /(?-i:a)b/i
  4760. \= Expect no match
  4761. AB
  4762. No match
  4763. Ab
  4764. No match
  4765. /((?-i:a))b/i
  4766. /(?-i:a)b/i
  4767. aB
  4768. 0: aB
  4769. /((?-i:a))b/i
  4770. aB
  4771. 0: aB
  4772. /(?-i:a)b/i
  4773. \= Expect no match
  4774. Ab
  4775. No match
  4776. AB
  4777. No match
  4778. /((?-i:a))b/i
  4779. /((?-i:a.))b/i
  4780. \= Expect no match
  4781. AB
  4782. No match
  4783. a\nB
  4784. No match
  4785. /((?s-i:a.))b/i
  4786. a\nB
  4787. 0: a\x0aB
  4788. /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
  4789. cabbbb
  4790. 0: cabbbb
  4791. /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
  4792. caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
  4793. 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
  4794. /foo\w*\d{4}baz/
  4795. foobar1234baz
  4796. 0: foobar1234baz
  4797. /x(~~)*(?:(?:F)?)?/
  4798. x~~
  4799. 0: x~~
  4800. 1: x
  4801. /^a(?#xxx){3}c/
  4802. aaac
  4803. 0: aaac
  4804. /^a (?#xxx) (?#yyy) {3}c/x
  4805. aaac
  4806. 0: aaac
  4807. /(?<![cd])b/
  4808. \= Expect no match
  4809. B\nB
  4810. No match
  4811. dbcb
  4812. No match
  4813. /(?<![cd])[ab]/
  4814. dbaacb
  4815. 0: a
  4816. /(?<!(c|d))b/
  4817. /(?<!(c|d))[ab]/
  4818. dbaacb
  4819. 0: a
  4820. /(?<!cd)[ab]/
  4821. cdaccb
  4822. 0: b
  4823. /^(?:a?b?)*$/
  4824. \= Expect no match
  4825. dbcb
  4826. No match
  4827. a--
  4828. No match
  4829. /((?s)^a(.))((?m)^b$)/
  4830. a\nb\nc\n
  4831. 0: a\x0ab
  4832. /((?m)^b$)/
  4833. a\nb\nc\n
  4834. 0: b
  4835. /(?m)^b/
  4836. a\nb\n
  4837. 0: b
  4838. /(?m)^(b)/
  4839. a\nb\n
  4840. 0: b
  4841. /((?m)^b)/
  4842. a\nb\n
  4843. 0: b
  4844. /\n((?m)^b)/
  4845. a\nb\n
  4846. 0: \x0ab
  4847. /((?s).)c(?!.)/
  4848. a\nb\nc\n
  4849. 0: \x0ac
  4850. a\nb\nc\n
  4851. 0: \x0ac
  4852. /((?s)b.)c(?!.)/
  4853. a\nb\nc\n
  4854. 0: b\x0ac
  4855. a\nb\nc\n
  4856. 0: b\x0ac
  4857. /^b/
  4858. /()^b/
  4859. \= Expect no match
  4860. a\nb\nc\n
  4861. No match
  4862. a\nb\nc\n
  4863. No match
  4864. /((?m)^b)/
  4865. a\nb\nc\n
  4866. 0: b
  4867. /(?(?!a)a|b)/
  4868. /(?(?!a)b|a)/
  4869. a
  4870. 0: a
  4871. /(?(?=a)b|a)/
  4872. \= Expect no match
  4873. a
  4874. No match
  4875. a
  4876. No match
  4877. /(?(?=a)a|b)/
  4878. a
  4879. 0: a
  4880. /(\w+:)+/
  4881. one:
  4882. 0: one:
  4883. /$(?<=^(a))/
  4884. a
  4885. 0:
  4886. /([\w:]+::)?(\w+)$/
  4887. abcd
  4888. 0: abcd
  4889. xy:z:::abcd
  4890. 0: xy:z:::abcd
  4891. /^[^bcd]*(c+)/
  4892. aexycd
  4893. 0: aexyc
  4894. /(a*)b+/
  4895. caab
  4896. 0: aab
  4897. /([\w:]+::)?(\w+)$/
  4898. abcd
  4899. 0: abcd
  4900. xy:z:::abcd
  4901. 0: xy:z:::abcd
  4902. \= Expect no match
  4903. abcd:
  4904. No match
  4905. abcd:
  4906. No match
  4907. /^[^bcd]*(c+)/
  4908. aexycd
  4909. 0: aexyc
  4910. /(>a+)ab/
  4911. /(?>a+)b/
  4912. aaab
  4913. 0: aaab
  4914. /([[:]+)/
  4915. a:[b]:
  4916. 0: :[
  4917. /([[=]+)/
  4918. a=[b]=
  4919. 0: =[
  4920. /([[.]+)/
  4921. a.[b].
  4922. 0: .[
  4923. /((?>a+)b)/
  4924. aaab
  4925. 0: aaab
  4926. /(?>(a+))b/
  4927. aaab
  4928. 0: aaab
  4929. /((?>[^()]+)|\([^()]*\))+/
  4930. ((abc(ade)ufh()()x
  4931. 0: abc(ade)ufh()()x
  4932. 1: abc(ade)ufh()()
  4933. 2: abc(ade)ufh()
  4934. 3: abc(ade)ufh
  4935. 4: abc(ade)
  4936. 5: abc
  4937. /a\Z/
  4938. \= Expect no match
  4939. aaab
  4940. No match
  4941. a\nb\n
  4942. No match
  4943. /b\Z/
  4944. a\nb\n
  4945. 0: b
  4946. /b\z/
  4947. /b\Z/
  4948. a\nb
  4949. 0: b
  4950. /b\z/
  4951. a\nb
  4952. 0: b
  4953. /(?>.*)(?<=(abcd|wxyz))/
  4954. alphabetabcd
  4955. 0: alphabetabcd
  4956. endingwxyz
  4957. 0: endingwxyz
  4958. \= Expect no match
  4959. a rather long string that doesn't end with one of them
  4960. No match
  4961. /word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
  4962. word cat dog elephant mussel cow horse canary baboon snake shark otherword
  4963. 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
  4964. \= Expect no match
  4965. word cat dog elephant mussel cow horse canary baboon snake shark
  4966. No match
  4967. /word (?>[a-zA-Z0-9]+ ){0,30}otherword/
  4968. \= Expect no match
  4969. word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
  4970. No match
  4971. /(?<=\d{3}(?!999))foo/
  4972. 999foo
  4973. 0: foo
  4974. 123999foo
  4975. 0: foo
  4976. \= Expect no match
  4977. 123abcfoo
  4978. No match
  4979. /(?<=(?!...999)\d{3})foo/
  4980. 999foo
  4981. 0: foo
  4982. 123999foo
  4983. 0: foo
  4984. \= Expect no match
  4985. 123abcfoo
  4986. No match
  4987. /(?<=\d{3}(?!999)...)foo/
  4988. 123abcfoo
  4989. 0: foo
  4990. 123456foo
  4991. 0: foo
  4992. \= Expect no match
  4993. 123999foo
  4994. No match
  4995. /(?<=\d{3}...)(?<!999)foo/
  4996. 123abcfoo
  4997. 0: foo
  4998. 123456foo
  4999. 0: foo
  5000. \= Expect no match
  5001. 123999foo
  5002. No match
  5003. /((Z)+|A)*/
  5004. ZABCDEFG
  5005. 0: ZA
  5006. 1: Z
  5007. 2:
  5008. /(Z()|A)*/
  5009. ZABCDEFG
  5010. 0: ZA
  5011. 1: Z
  5012. 2:
  5013. /(Z(())|A)*/
  5014. ZABCDEFG
  5015. 0: ZA
  5016. 1: Z
  5017. 2:
  5018. /((?>Z)+|A)*/
  5019. ZABCDEFG
  5020. 0: ZA
  5021. 1: Z
  5022. 2:
  5023. /((?>)+|A)*/
  5024. ZABCDEFG
  5025. 0:
  5026. /a*/g
  5027. abbab
  5028. 0: a
  5029. 0:
  5030. 0:
  5031. 0: a
  5032. 0:
  5033. 0:
  5034. /[[:space:]]+/
  5035. > \x09\x0a\x0c\x0d\x0b<
  5036. 0: \x09\x0a\x0c\x0d\x0b
  5037. /[[:blank:]]+/
  5038. > \x09\x0a\x0c\x0d\x0b<
  5039. 0: \x09
  5040. /[\s]+/
  5041. > \x09\x0a\x0c\x0d\x0b<
  5042. 0: \x09\x0a\x0c\x0d\x0b
  5043. /\s+/
  5044. > \x09\x0a\x0c\x0d\x0b<
  5045. 0: \x09\x0a\x0c\x0d\x0b
  5046. /a b/x
  5047. ab
  5048. 0: ab
  5049. /(?!\A)x/m
  5050. a\nxb\n
  5051. 0: x
  5052. /(?!^)x/m
  5053. \= Expect no match
  5054. a\nxb\n
  5055. No match
  5056. /abc\Qabc\Eabc/
  5057. abcabcabc
  5058. 0: abcabcabc
  5059. /abc\Q(*+|\Eabc/
  5060. abc(*+|abc
  5061. 0: abc(*+|abc
  5062. / abc\Q abc\Eabc/x
  5063. abc abcabc
  5064. 0: abc abcabc
  5065. \= Expect no match
  5066. abcabcabc
  5067. No match
  5068. /abc#comment
  5069. \Q#not comment
  5070. literal\E/x
  5071. abc#not comment\n literal
  5072. 0: abc#not comment\x0a literal
  5073. /abc#comment
  5074. \Q#not comment
  5075. literal/x
  5076. abc#not comment\n literal
  5077. 0: abc#not comment\x0a literal
  5078. /abc#comment
  5079. \Q#not comment
  5080. literal\E #more comment
  5081. /x
  5082. abc#not comment\n literal
  5083. 0: abc#not comment\x0a literal
  5084. /abc#comment
  5085. \Q#not comment
  5086. literal\E #more comment/x
  5087. abc#not comment\n literal
  5088. 0: abc#not comment\x0a literal
  5089. /\Qabc\$xyz\E/
  5090. abc\\\$xyz
  5091. 0: abc\$xyz
  5092. /\Qabc\E\$\Qxyz\E/
  5093. abc\$xyz
  5094. 0: abc$xyz
  5095. /\Gabc/
  5096. abc
  5097. 0: abc
  5098. \= Expect no match
  5099. xyzabc
  5100. No match
  5101. /\Gabc./g
  5102. abc1abc2xyzabc3
  5103. 0: abc1
  5104. 0: abc2
  5105. /abc./g
  5106. abc1abc2xyzabc3
  5107. 0: abc1
  5108. 0: abc2
  5109. 0: abc3
  5110. /a(?x: b c )d/
  5111. XabcdY
  5112. 0: abcd
  5113. \= Expect no match
  5114. Xa b c d Y
  5115. No match
  5116. /((?x)x y z | a b c)/
  5117. XabcY
  5118. 0: abc
  5119. AxyzB
  5120. 0: xyz
  5121. /(?i)AB(?-i)C/
  5122. XabCY
  5123. 0: abC
  5124. \= Expect no match
  5125. XabcY
  5126. No match
  5127. /((?i)AB(?-i)C|D)E/
  5128. abCE
  5129. 0: abCE
  5130. DE
  5131. 0: DE
  5132. \= Expect no match
  5133. abcE
  5134. No match
  5135. abCe
  5136. No match
  5137. dE
  5138. No match
  5139. De
  5140. No match
  5141. /[z\Qa-d]\E]/
  5142. z
  5143. 0: z
  5144. a
  5145. 0: a
  5146. -
  5147. 0: -
  5148. d
  5149. 0: d
  5150. ]
  5151. 0: ]
  5152. \= Expect no match
  5153. b
  5154. No match
  5155. /(a+)*b/
  5156. \= Expect no match
  5157. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  5158. No match
  5159. /(?i)reg(?:ul(?:[a�]|ae)r|ex)/
  5160. REGular
  5161. 0: REGular
  5162. regulaer
  5163. 0: regulaer
  5164. Regex
  5165. 0: Regex
  5166. regul�r
  5167. 0: regul\xe4r
  5168. /����[�-��-�]+/
  5169. �����
  5170. 0: \xc5\xe6\xe5\xe4\xe0
  5171. �����
  5172. 0: \xc5\xe6\xe5\xe4\xff
  5173. �����
  5174. 0: \xc5\xe6\xe5\xe4\xc0
  5175. �����
  5176. 0: \xc5\xe6\xe5\xe4\xdf
  5177. /(?<=Z)X./
  5178. \x84XAZXB
  5179. 0: XB
  5180. /^(?(2)a|(1)(2))+$/
  5181. 123a
  5182. Failed: error -40: backreference condition or recursion test is not supported for DFA matching
  5183. /(?<=a|bbbb)c/
  5184. ac
  5185. 0: c
  5186. bbbbc
  5187. 0: c
  5188. /line\nbreak/
  5189. this is a line\nbreak
  5190. 0: line\x0abreak
  5191. line one\nthis is a line\nbreak in the second line
  5192. 0: line\x0abreak
  5193. /line\nbreak/firstline
  5194. this is a line\nbreak
  5195. 0: line\x0abreak
  5196. \= Expect no match
  5197. line one\nthis is a line\nbreak in the second line
  5198. No match
  5199. /line\nbreak/m,firstline
  5200. this is a line\nbreak
  5201. 0: line\x0abreak
  5202. \= Expect no match
  5203. line one\nthis is a line\nbreak in the second line
  5204. No match
  5205. /1234/
  5206. 123\=ps
  5207. Partial match: 123
  5208. \= Expect no match
  5209. a4\=ps,dfa_restart
  5210. No match
  5211. /1234/
  5212. 123\=ps
  5213. Partial match: 123
  5214. 4\=ps,dfa_restart
  5215. 0: 4
  5216. /^/gm
  5217. a\nb\nc\n
  5218. 0:
  5219. 0:
  5220. 0:
  5221. \
  5222. 0:
  5223. /(?<=C\n)^/gm
  5224. A\nC\nC\n
  5225. 0:
  5226. /(?s)A?B/
  5227. AB
  5228. 0: AB
  5229. aB
  5230. 0: B
  5231. /(?s)A*B/
  5232. AB
  5233. 0: AB
  5234. aB
  5235. 0: B
  5236. /(?m)A?B/
  5237. AB
  5238. 0: AB
  5239. aB
  5240. 0: B
  5241. /(?m)A*B/
  5242. AB
  5243. 0: AB
  5244. aB
  5245. 0: B
  5246. /Content-Type\x3A[^\r\n]{6,}/
  5247. Content-Type:xxxxxyyy
  5248. 0: Content-Type:xxxxxyyy
  5249. /Content-Type\x3A[^\r\n]{6,}z/
  5250. Content-Type:xxxxxyyyz
  5251. 0: Content-Type:xxxxxyyyz
  5252. /Content-Type\x3A[^a]{6,}/
  5253. Content-Type:xxxyyy
  5254. 0: Content-Type:xxxyyy
  5255. /Content-Type\x3A[^a]{6,}z/
  5256. Content-Type:xxxyyyz
  5257. 0: Content-Type:xxxyyyz
  5258. /^abc/Im,newline=lf
  5259. Capture group count = 0
  5260. Options: multiline
  5261. Forced newline is LF
  5262. First code unit at start or follows newline
  5263. Last code unit = 'c'
  5264. Subject length lower bound = 3
  5265. xyz\nabc
  5266. 0: abc
  5267. xyz\r\nabc
  5268. 0: abc
  5269. \= Expect no match
  5270. xyz\rabc
  5271. No match
  5272. xyzabc\r
  5273. No match
  5274. xyzabc\rpqr
  5275. No match
  5276. xyzabc\r\n
  5277. No match
  5278. xyzabc\r\npqr
  5279. No match
  5280. /^abc/Im,newline=crlf
  5281. Capture group count = 0
  5282. Options: multiline
  5283. Forced newline is CRLF
  5284. First code unit at start or follows newline
  5285. Last code unit = 'c'
  5286. Subject length lower bound = 3
  5287. xyz\r\nabclf>
  5288. 0: abc
  5289. \= Expect no match
  5290. xyz\nabclf
  5291. No match
  5292. xyz\rabclf
  5293. No match
  5294. /^abc/Im,newline=cr
  5295. Capture group count = 0
  5296. Options: multiline
  5297. Forced newline is CR
  5298. First code unit at start or follows newline
  5299. Last code unit = 'c'
  5300. Subject length lower bound = 3
  5301. xyz\rabc
  5302. 0: abc
  5303. \= Expect no match
  5304. xyz\nabc
  5305. No match
  5306. xyz\r\nabc
  5307. No match
  5308. /.*/I,newline=lf
  5309. Capture group count = 0
  5310. May match empty string
  5311. Forced newline is LF
  5312. First code unit at start or follows newline
  5313. Subject length lower bound = 0
  5314. abc\ndef
  5315. 0: abc
  5316. abc\rdef
  5317. 0: abc\x0ddef
  5318. abc\r\ndef
  5319. 0: abc\x0d
  5320. /.*/I,newline=cr
  5321. Capture group count = 0
  5322. May match empty string
  5323. Forced newline is CR
  5324. First code unit at start or follows newline
  5325. Subject length lower bound = 0
  5326. abc\ndef
  5327. 0: abc\x0adef
  5328. abc\rdef
  5329. 0: abc
  5330. abc\r\ndef
  5331. 0: abc
  5332. /.*/I,newline=crlf
  5333. Capture group count = 0
  5334. May match empty string
  5335. Forced newline is CRLF
  5336. First code unit at start or follows newline
  5337. Subject length lower bound = 0
  5338. abc\ndef
  5339. 0: abc\x0adef
  5340. abc\rdef
  5341. 0: abc\x0ddef
  5342. abc\r\ndef
  5343. 0: abc
  5344. /\w+(.)(.)?def/Is
  5345. Capture group count = 2
  5346. Options: dotall
  5347. Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
  5348. Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
  5349. Last code unit = 'f'
  5350. Subject length lower bound = 5
  5351. abc\ndef
  5352. 0: abc\x0adef
  5353. abc\rdef
  5354. 0: abc\x0ddef
  5355. abc\r\ndef
  5356. 0: abc\x0d\x0adef
  5357. /\w+(.)(.)?def/s
  5358. abc\ndef
  5359. 0: abc\x0adef
  5360. abc\rdef
  5361. 0: abc\x0ddef
  5362. abc\r\ndef
  5363. 0: abc\x0d\x0adef
  5364. /^\w+=.*(\\\n.*)*/
  5365. abc=xyz\\\npqr
  5366. 0: abc=xyz\\x0apqr
  5367. 1: abc=xyz\\x0apq
  5368. 2: abc=xyz\\x0ap
  5369. 3: abc=xyz\\x0a
  5370. 4: abc=xyz\
  5371. 5: abc=xyz
  5372. 6: abc=xy
  5373. 7: abc=x
  5374. 8: abc=
  5375. /^(a()*)*/
  5376. aaaa
  5377. 0: aaaa
  5378. 1: aaa
  5379. 2: aa
  5380. 3: a
  5381. 4:
  5382. /^(?:a(?:(?:))*)*/
  5383. aaaa
  5384. 0: aaaa
  5385. 1: aaa
  5386. 2: aa
  5387. 3: a
  5388. 4:
  5389. /^(a()+)+/
  5390. aaaa
  5391. 0: aaaa
  5392. 1: aaa
  5393. 2: aa
  5394. 3: a
  5395. /^(?:a(?:(?:))+)+/
  5396. aaaa
  5397. 0: aaaa
  5398. 1: aaa
  5399. 2: aa
  5400. 3: a
  5401. /(a|)*\d/
  5402. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5403. 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5404. \= Expect no match
  5405. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  5406. No match
  5407. /(?>a|)*\d/
  5408. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5409. 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5410. \= Expect no match
  5411. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  5412. No match
  5413. /(?:a|)*\d/
  5414. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5415. 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
  5416. \= Expect no match
  5417. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  5418. No match
  5419. /^a.b/newline=lf
  5420. a\rb
  5421. 0: a\x0db
  5422. \= Expect no match
  5423. a\nb
  5424. No match
  5425. /^a.b/newline=cr
  5426. a\nb
  5427. 0: a\x0ab
  5428. \= Expect no match
  5429. a\rb
  5430. No match
  5431. /^a.b/newline=anycrlf
  5432. a\x85b
  5433. 0: a\x85b
  5434. \= Expect no match
  5435. a\rb
  5436. No match
  5437. /^a.b/newline=any
  5438. \= Expect no match
  5439. a\nb
  5440. No match
  5441. a\rb
  5442. No match
  5443. a\x85b
  5444. No match
  5445. /^abc./gmx,newline=any
  5446. abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
  5447. 0: abc1
  5448. 0: abc2
  5449. 0: abc3
  5450. 0: abc4
  5451. 0: abc5
  5452. 0: abc6
  5453. 0: abc7
  5454. /abc.$/gmx,newline=any
  5455. abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
  5456. 0: abc1
  5457. 0: abc2
  5458. 0: abc3
  5459. 0: abc4
  5460. 0: abc5
  5461. 0: abc6
  5462. 0: abc9
  5463. /^a\Rb/bsr=unicode
  5464. a\nb
  5465. 0: a\x0ab
  5466. a\rb
  5467. 0: a\x0db
  5468. a\r\nb
  5469. 0: a\x0d\x0ab
  5470. a\x0bb
  5471. 0: a\x0bb
  5472. a\x0cb
  5473. 0: a\x0cb
  5474. a\x85b
  5475. 0: a\x85b
  5476. \= Expect no match
  5477. a\n\rb
  5478. No match
  5479. /^a\R*b/bsr=unicode
  5480. ab
  5481. 0: ab
  5482. a\nb
  5483. 0: a\x0ab
  5484. a\rb
  5485. 0: a\x0db
  5486. a\r\nb
  5487. 0: a\x0d\x0ab
  5488. a\x0bb
  5489. 0: a\x0bb
  5490. a\x0cb
  5491. 0: a\x0cb
  5492. a\x85b
  5493. 0: a\x85b
  5494. a\n\rb
  5495. 0: a\x0a\x0db
  5496. a\n\r\x85\x0cb
  5497. 0: a\x0a\x0d\x85\x0cb
  5498. /^a\R+b/bsr=unicode
  5499. a\nb
  5500. 0: a\x0ab
  5501. a\rb
  5502. 0: a\x0db
  5503. a\r\nb
  5504. 0: a\x0d\x0ab
  5505. a\x0bb
  5506. 0: a\x0bb
  5507. a\x0cb
  5508. 0: a\x0cb
  5509. a\x85b
  5510. 0: a\x85b
  5511. a\n\rb
  5512. 0: a\x0a\x0db
  5513. a\n\r\x85\x0cb
  5514. 0: a\x0a\x0d\x85\x0cb
  5515. \= Expect no match
  5516. ab
  5517. No match
  5518. /^a\R{1,3}b/bsr=unicode
  5519. a\nb
  5520. 0: a\x0ab
  5521. a\n\rb
  5522. 0: a\x0a\x0db
  5523. a\n\r\x85b
  5524. 0: a\x0a\x0d\x85b
  5525. a\r\n\r\nb
  5526. 0: a\x0d\x0a\x0d\x0ab
  5527. a\r\n\r\n\r\nb
  5528. 0: a\x0d\x0a\x0d\x0a\x0d\x0ab
  5529. a\n\r\n\rb
  5530. 0: a\x0a\x0d\x0a\x0db
  5531. a\n\n\r\nb
  5532. 0: a\x0a\x0a\x0d\x0ab
  5533. \= Expect no match
  5534. a\n\n\n\rb
  5535. No match
  5536. a\r
  5537. No match
  5538. /.+foo/
  5539. afoo
  5540. 0: afoo
  5541. \= Expect no match
  5542. \r\nfoo
  5543. No match
  5544. \nfoo
  5545. No match
  5546. /.+foo/newline=crlf
  5547. afoo
  5548. 0: afoo
  5549. \nfoo
  5550. 0: \x0afoo
  5551. \= Expect no match
  5552. \r\nfoo
  5553. No match
  5554. /.+foo/newline=any
  5555. afoo
  5556. 0: afoo
  5557. \= Expect no match
  5558. \nfoo
  5559. No match
  5560. \r\nfoo
  5561. No match
  5562. /.+foo/s
  5563. afoo
  5564. 0: afoo
  5565. \r\nfoo
  5566. 0: \x0d\x0afoo
  5567. \nfoo
  5568. 0: \x0afoo
  5569. /^$/gm,newline=any
  5570. abc\r\rxyz
  5571. 0:
  5572. abc\n\rxyz
  5573. 0:
  5574. \= Expect no match
  5575. abc\r\nxyz
  5576. No match
  5577. /^X/m
  5578. XABC
  5579. 0: X
  5580. \= Expect no match
  5581. XABC\=notbol
  5582. No match
  5583. /(?m)^$/g,newline=any,aftertext
  5584. abc\r\n\r\n
  5585. 0:
  5586. 0+ \x0d\x0a
  5587. /(?m)^$|^\r\n/g,newline=any,aftertext
  5588. abc\r\n\r\n
  5589. 0: \x0d\x0a
  5590. 0+
  5591. 1:
  5592. /(?m)$/g,newline=any,aftertext
  5593. abc\r\n\r\n
  5594. 0:
  5595. 0+ \x0d\x0a\x0d\x0a
  5596. 0:
  5597. 0+ \x0d\x0a
  5598. 0:
  5599. 0+
  5600. /(?|(abc)|(xyz))/
  5601. >abc<
  5602. 0: abc
  5603. >xyz<
  5604. 0: xyz
  5605. /(x)(?|(abc)|(xyz))(x)/
  5606. xabcx
  5607. 0: xabcx
  5608. xxyzx
  5609. 0: xxyzx
  5610. /(x)(?|(abc)(pqr)|(xyz))(x)/
  5611. xabcpqrx
  5612. 0: xabcpqrx
  5613. xxyzx
  5614. 0: xxyzx
  5615. /(?|(abc)|(xyz))(?1)/
  5616. abcabc
  5617. 0: abcabc
  5618. xyzabc
  5619. 0: xyzabc
  5620. \= Expect no match
  5621. xyzxyz
  5622. No match
  5623. /\H\h\V\v/
  5624. X X\x0a
  5625. 0: X X\x0a
  5626. X\x09X\x0b
  5627. 0: X\x09X\x0b
  5628. \= Expect no match
  5629. \xa0 X\x0a
  5630. No match
  5631. /\H*\h+\V?\v{3,4}/
  5632. \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
  5633. 0: \x09 \xa0X\x0a\x0b\x0c\x0d
  5634. \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
  5635. 0: \x09 \xa0\x0a\x0b\x0c\x0d
  5636. \x09\x20\xa0\x0a\x0b\x0c
  5637. 0: \x09 \xa0\x0a\x0b\x0c
  5638. \= Expect no match
  5639. \x09\x20\xa0\x0a\x0b
  5640. No match
  5641. /\H{3,4}/
  5642. XY ABCDE
  5643. 0: ABCD
  5644. XY PQR ST
  5645. 0: PQR
  5646. /.\h{3,4}./
  5647. XY AB PQRS
  5648. 0: B P
  5649. 1: B
  5650. /\h*X\h?\H+Y\H?Z/
  5651. >XNNNYZ
  5652. 0: XNNNYZ
  5653. > X NYQZ
  5654. 0: X NYQZ
  5655. \= Expect no match
  5656. >XYZ
  5657. No match
  5658. > X NY Z
  5659. No match
  5660. /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
  5661. >XY\x0aZ\x0aA\x0bNN\x0c
  5662. 0: XY\x0aZ\x0aA\x0bNN\x0c
  5663. >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
  5664. 0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
  5665. /.+A/newline=crlf
  5666. \= Expect no match
  5667. \r\nA
  5668. No match
  5669. /\nA/newline=crlf
  5670. \r\nA
  5671. 0: \x0aA
  5672. /[\r\n]A/newline=crlf
  5673. \r\nA
  5674. 0: \x0aA
  5675. /(\r|\n)A/newline=crlf
  5676. \r\nA
  5677. 0: \x0aA
  5678. /a\Rb/I,bsr=anycrlf
  5679. Capture group count = 0
  5680. \R matches CR, LF, or CRLF
  5681. First code unit = 'a'
  5682. Last code unit = 'b'
  5683. Subject length lower bound = 3
  5684. a\rb
  5685. 0: a\x0db
  5686. a\nb
  5687. 0: a\x0ab
  5688. a\r\nb
  5689. 0: a\x0d\x0ab
  5690. \= Expect no match
  5691. a\x85b
  5692. No match
  5693. a\x0bb
  5694. No match
  5695. /a\Rb/I,bsr=unicode
  5696. Capture group count = 0
  5697. \R matches any Unicode newline
  5698. First code unit = 'a'
  5699. Last code unit = 'b'
  5700. Subject length lower bound = 3
  5701. a\rb
  5702. 0: a\x0db
  5703. a\nb
  5704. 0: a\x0ab
  5705. a\r\nb
  5706. 0: a\x0d\x0ab
  5707. a\x85b
  5708. 0: a\x85b
  5709. a\x0bb
  5710. 0: a\x0bb
  5711. /a\R?b/I,bsr=anycrlf
  5712. Capture group count = 0
  5713. \R matches CR, LF, or CRLF
  5714. First code unit = 'a'
  5715. Last code unit = 'b'
  5716. Subject length lower bound = 2
  5717. a\rb
  5718. 0: a\x0db
  5719. a\nb
  5720. 0: a\x0ab
  5721. a\r\nb
  5722. 0: a\x0d\x0ab
  5723. \= Expect no match
  5724. a\x85b
  5725. No match
  5726. a\x0bb
  5727. No match
  5728. /a\R?b/I,bsr=unicode
  5729. Capture group count = 0
  5730. \R matches any Unicode newline
  5731. First code unit = 'a'
  5732. Last code unit = 'b'
  5733. Subject length lower bound = 2
  5734. a\rb
  5735. 0: a\x0db
  5736. a\nb
  5737. 0: a\x0ab
  5738. a\r\nb
  5739. 0: a\x0d\x0ab
  5740. a\x85b
  5741. 0: a\x85b
  5742. a\x0bb
  5743. 0: a\x0bb
  5744. /a\R{2,4}b/I,bsr=anycrlf
  5745. Capture group count = 0
  5746. \R matches CR, LF, or CRLF
  5747. First code unit = 'a'
  5748. Last code unit = 'b'
  5749. Subject length lower bound = 4
  5750. a\r\n\nb
  5751. 0: a\x0d\x0a\x0ab
  5752. a\n\r\rb
  5753. 0: a\x0a\x0d\x0db
  5754. a\r\n\r\n\r\n\r\nb
  5755. 0: a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0ab
  5756. \= Expect no match
  5757. a\x0b\x0bb
  5758. No match
  5759. a\x85\x85b
  5760. No match
  5761. /a\R{2,4}b/I,bsr=unicode
  5762. Capture group count = 0
  5763. \R matches any Unicode newline
  5764. First code unit = 'a'
  5765. Last code unit = 'b'
  5766. Subject length lower bound = 4
  5767. a\r\rb
  5768. 0: a\x0d\x0db
  5769. a\n\n\nb
  5770. 0: a\x0a\x0a\x0ab
  5771. a\r\n\n\r\rb
  5772. 0: a\x0d\x0a\x0a\x0d\x0db
  5773. a\x85\x85b
  5774. 0: a\x85\x85b
  5775. a\x0b\x0bb
  5776. 0: a\x0b\x0bb
  5777. \= Expect no match
  5778. a\r\r\r\r\rb
  5779. No match
  5780. /a(?!)|\wbc/
  5781. abc
  5782. 0: abc
  5783. /a[]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  5784. \= Expect no match
  5785. ab
  5786. No match
  5787. /a[]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  5788. \= Expect no match
  5789. ab
  5790. No match
  5791. /a[]*+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  5792. \= Expect no match
  5793. ab
  5794. No match
  5795. /a[^]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  5796. aXb
  5797. 0: aXb
  5798. a\nb
  5799. 0: a\x0ab
  5800. \= Expect no match
  5801. ab
  5802. No match
  5803. /a[^]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  5804. aXb
  5805. 0: aXb
  5806. a\nX\nXb
  5807. 0: a\x0aX\x0aXb
  5808. \= Expect no match
  5809. ab
  5810. No match
  5811. /X$/dollar_endonly
  5812. X
  5813. 0: X
  5814. \= Expect no match
  5815. X\n
  5816. No match
  5817. /X$/
  5818. X
  5819. 0: X
  5820. X\n
  5821. 0: X
  5822. /xyz/auto_callout
  5823. xyz
  5824. --->xyz
  5825. +0 ^ x
  5826. +1 ^^ y
  5827. +2 ^ ^ z
  5828. +3 ^ ^ End of pattern
  5829. 0: xyz
  5830. abcxyz
  5831. --->abcxyz
  5832. +0 ^ x
  5833. +1 ^^ y
  5834. +2 ^ ^ z
  5835. +3 ^ ^ End of pattern
  5836. 0: xyz
  5837. \= Expect no match
  5838. abc
  5839. No match
  5840. abcxypqr
  5841. No match
  5842. /xyz/auto_callout,no_start_optimize
  5843. abcxyz
  5844. --->abcxyz
  5845. +0 ^ x
  5846. +0 ^ x
  5847. +0 ^ x
  5848. +0 ^ x
  5849. +1 ^^ y
  5850. +2 ^ ^ z
  5851. +3 ^ ^ End of pattern
  5852. 0: xyz
  5853. \= Expect no match
  5854. abc
  5855. --->abc
  5856. +0 ^ x
  5857. +0 ^ x
  5858. +0 ^ x
  5859. +0 ^ x
  5860. No match
  5861. abcxypqr
  5862. --->abcxypqr
  5863. +0 ^ x
  5864. +0 ^ x
  5865. +0 ^ x
  5866. +0 ^ x
  5867. +1 ^^ y
  5868. +2 ^ ^ z
  5869. +0 ^ x
  5870. +0 ^ x
  5871. +0 ^ x
  5872. +0 ^ x
  5873. +0 ^ x
  5874. No match
  5875. /(*NO_START_OPT)xyz/auto_callout
  5876. abcxyz
  5877. --->abcxyz
  5878. +15 ^ x
  5879. +15 ^ x
  5880. +15 ^ x
  5881. +15 ^ x
  5882. +16 ^^ y
  5883. +17 ^ ^ z
  5884. +18 ^ ^ End of pattern
  5885. 0: xyz
  5886. /(?C)ab/
  5887. ab
  5888. --->ab
  5889. 0 ^ a
  5890. 0: ab
  5891. ab\=callout_none
  5892. 0: ab
  5893. /ab/auto_callout
  5894. ab
  5895. --->ab
  5896. +0 ^ a
  5897. +1 ^^ b
  5898. +2 ^ ^ End of pattern
  5899. 0: ab
  5900. ab\=callout_none
  5901. 0: ab
  5902. /^"((?(?=[a])[^"])|b)*"$/auto_callout
  5903. "ab"
  5904. --->"ab"
  5905. +0 ^ ^
  5906. +1 ^ "
  5907. +2 ^^ (
  5908. +21 ^^ "
  5909. +3 ^^ (?
  5910. +18 ^^ b
  5911. +5 ^^ (?=
  5912. +8 ^ [a]
  5913. +11 ^^ )
  5914. +12 ^^ [^"]
  5915. +16 ^ ^ )
  5916. +17 ^ ^ |
  5917. +21 ^ ^ "
  5918. +3 ^ ^ (?
  5919. +18 ^ ^ b
  5920. +5 ^ ^ (?=
  5921. +8 ^ [a]
  5922. +19 ^ ^ )*
  5923. +21 ^ ^ "
  5924. +3 ^ ^ (?
  5925. +18 ^ ^ b
  5926. +5 ^ ^ (?=
  5927. +8 ^ [a]
  5928. +17 ^ ^ |
  5929. +22 ^ ^ $
  5930. +23 ^ ^ End of pattern
  5931. 0: "ab"
  5932. "ab"\=callout_none
  5933. 0: "ab"
  5934. /\d+X|9+Y/
  5935. ++++123999\=ps
  5936. Partial match: 123999
  5937. ++++123999Y\=ps
  5938. 0: 999Y
  5939. /Z(*F)/
  5940. \= Expect no match
  5941. Z\=ps
  5942. No match
  5943. ZA\=ps
  5944. No match
  5945. /Z(?!)/
  5946. \= Expect no match
  5947. Z\=ps
  5948. No match
  5949. ZA\=ps
  5950. No match
  5951. /dog(sbody)?/
  5952. dogs\=ps
  5953. 0: dog
  5954. dogs\=ph
  5955. Partial match: dogs
  5956. /dog(sbody)??/
  5957. dogs\=ps
  5958. 0: dog
  5959. dogs\=ph
  5960. Partial match: dogs
  5961. /dog|dogsbody/
  5962. dogs\=ps
  5963. 0: dog
  5964. dogs\=ph
  5965. Partial match: dogs
  5966. /dogsbody|dog/
  5967. dogs\=ps
  5968. 0: dog
  5969. dogs\=ph
  5970. Partial match: dogs
  5971. /Z(*F)Q|ZXY/
  5972. Z\=ps
  5973. Partial match: Z
  5974. \= Expect no match
  5975. ZA\=ps
  5976. No match
  5977. X\=ps
  5978. No match
  5979. /\bthe cat\b/
  5980. the cat\=ps
  5981. 0: the cat
  5982. the cat\=ph
  5983. Partial match: the cat
  5984. /dog(sbody)?/
  5985. dogs\=ps
  5986. 0: dog
  5987. body\=dfa_restart
  5988. 0: body
  5989. /dog(sbody)?/
  5990. dogs\=ph
  5991. Partial match: dogs
  5992. body\=dfa_restart
  5993. 0: body
  5994. /abc/
  5995. abc\=ps
  5996. 0: abc
  5997. abc\=ph
  5998. 0: abc
  5999. /abc\K123/
  6000. xyzabc123pqr
  6001. Failed: error -42: pattern contains an item that is not supported for DFA matching
  6002. /(?<=abc)123/allusedtext
  6003. xyzabc123pqr
  6004. 0: abc123
  6005. <<<
  6006. xyzabc12\=ps
  6007. Partial match: abc12
  6008. <<<
  6009. xyzabc12\=ph
  6010. Partial match: abc12
  6011. <<<
  6012. /\babc\b/allusedtext
  6013. +++abc+++
  6014. 0: +abc+
  6015. < >
  6016. +++ab\=ps
  6017. Partial match: +ab
  6018. <
  6019. +++ab\=ph
  6020. Partial match: +ab
  6021. <
  6022. /(?=C)/g,aftertext
  6023. ABCDECBA
  6024. 0:
  6025. 0+ CDECBA
  6026. 0:
  6027. 0+ CBA
  6028. /(abc|def|xyz)/I
  6029. Capture group count = 1
  6030. Starting code units: a d x
  6031. Subject length lower bound = 3
  6032. terhjk;abcdaadsfe
  6033. 0: abc
  6034. the quick xyz brown fox
  6035. 0: xyz
  6036. \= Expect no match
  6037. thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
  6038. No match
  6039. /(abc|def|xyz)/I,no_start_optimize
  6040. Capture group count = 1
  6041. Options: no_start_optimize
  6042. terhjk;abcdaadsfe
  6043. 0: abc
  6044. the quick xyz brown fox
  6045. 0: xyz
  6046. \= Expect no match
  6047. thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
  6048. No match
  6049. /abcd*/aftertext
  6050. xxxxabcd\=ps
  6051. 0: abcd
  6052. 0+
  6053. xxxxabcd\=ph
  6054. Partial match: abcd
  6055. dddxxx\=dfa_restart
  6056. 0: ddd
  6057. 0+ xxx
  6058. xxxxabcd\=ph
  6059. Partial match: abcd
  6060. xxx\=dfa_restart
  6061. 0:
  6062. 0+ xxx
  6063. /abcd*/i
  6064. xxxxabcd\=ps
  6065. 0: abcd
  6066. xxxxabcd\=ph
  6067. Partial match: abcd
  6068. XXXXABCD\=ps
  6069. 0: ABCD
  6070. XXXXABCD\=ph
  6071. Partial match: ABCD
  6072. /abc\d*/
  6073. xxxxabc1\=ps
  6074. 0: abc1
  6075. xxxxabc1\=ph
  6076. Partial match: abc1
  6077. /abc[de]*/
  6078. xxxxabcde\=ps
  6079. 0: abcde
  6080. xxxxabcde\=ph
  6081. Partial match: abcde
  6082. /(?:(?1)|B)(A(*F)|C)/
  6083. ABCD
  6084. 0: BC
  6085. CCD
  6086. 0: CC
  6087. \= Expect no match
  6088. CAD
  6089. No match
  6090. /^(?:(?1)|B)(A(*F)|C)/
  6091. CCD
  6092. 0: CC
  6093. BCD
  6094. 0: BC
  6095. \= Expect no match
  6096. ABCD
  6097. No match
  6098. CAD
  6099. No match
  6100. BAD
  6101. No match
  6102. /^(?!a(*SKIP)b)/
  6103. ac
  6104. Failed: error -42: pattern contains an item that is not supported for DFA matching
  6105. /^(?=a(*SKIP)b|ac)/
  6106. ac
  6107. Failed: error -42: pattern contains an item that is not supported for DFA matching
  6108. /^(?=a(*THEN)b|ac)/
  6109. ac
  6110. Failed: error -42: pattern contains an item that is not supported for DFA matching
  6111. /^(?=a(*PRUNE)b)/
  6112. ab
  6113. Failed: error -42: pattern contains an item that is not supported for DFA matching
  6114. /^(?(?!a(*SKIP)b))/
  6115. ac
  6116. Failed: error -42: pattern contains an item that is not supported for DFA matching
  6117. /(?<=abc)def/allusedtext
  6118. abc\=ph
  6119. Partial match: abc
  6120. <<<
  6121. /abc$/
  6122. abc
  6123. 0: abc
  6124. abc\=ps
  6125. 0: abc
  6126. abc\=ph
  6127. Partial match: abc
  6128. /abc$/m
  6129. abc
  6130. 0: abc
  6131. abc\n
  6132. 0: abc
  6133. abc\=ph
  6134. Partial match: abc
  6135. abc\n\=ph
  6136. 0: abc
  6137. abc\=ps
  6138. 0: abc
  6139. abc\n\=ps
  6140. 0: abc
  6141. /abc\z/
  6142. abc
  6143. 0: abc
  6144. abc\=ps
  6145. 0: abc
  6146. abc\=ph
  6147. Partial match: abc
  6148. /abc\Z/
  6149. abc
  6150. 0: abc
  6151. abc\=ps
  6152. 0: abc
  6153. abc\=ph
  6154. Partial match: abc
  6155. /abc\b/
  6156. abc
  6157. 0: abc
  6158. abc\=ps
  6159. 0: abc
  6160. abc\=ph
  6161. Partial match: abc
  6162. /abc\B/
  6163. abc\=ps
  6164. Partial match: abc
  6165. abc\=ph
  6166. Partial match: abc
  6167. \= Expect no match
  6168. abc
  6169. No match
  6170. /.+/
  6171. abc\=offset=0
  6172. 0: abc
  6173. abc\=offset=1
  6174. 0: bc
  6175. abc\=offset=2
  6176. 0: c
  6177. \= Bad offsets
  6178. abc\=offset=4
  6179. Failed: error -33: bad offset value
  6180. abc\=offset=-4
  6181. ** Invalid value in 'offset=-4'
  6182. \= Expect no match
  6183. abc\=offset=3
  6184. No match
  6185. /^(?:a)++\w/
  6186. aaaab
  6187. 0: aaaab
  6188. \= Expect no match
  6189. aaaa
  6190. No match
  6191. bbb
  6192. No match
  6193. /^(?:aa|(?:a)++\w)/
  6194. aaaab
  6195. 0: aaaab
  6196. 1: aa
  6197. aaaa
  6198. 0: aa
  6199. \= Expect no match
  6200. bbb
  6201. No match
  6202. /^(?:a)*+\w/
  6203. aaaab
  6204. 0: aaaab
  6205. bbb
  6206. 0: b
  6207. \= Expect no match
  6208. aaaa
  6209. No match
  6210. /^(a)++\w/
  6211. aaaab
  6212. 0: aaaab
  6213. \= Expect no match
  6214. aaaa
  6215. No match
  6216. bbb
  6217. No match
  6218. /^(a|)++\w/
  6219. aaaab
  6220. 0: aaaab
  6221. \= Expect no match
  6222. aaaa
  6223. No match
  6224. bbb
  6225. No match
  6226. /(?=abc){3}abc/aftertext
  6227. abcabcabc
  6228. 0: abc
  6229. 0+ abcabc
  6230. \= Expect no match
  6231. xyz
  6232. No match
  6233. /(?=abc)+abc/aftertext
  6234. abcabcabc
  6235. 0: abc
  6236. 0+ abcabc
  6237. \= Expect no match
  6238. xyz
  6239. No match
  6240. /(?=abc)++abc/aftertext
  6241. abcabcabc
  6242. 0: abc
  6243. 0+ abcabc
  6244. \= Expect no match
  6245. xyz
  6246. No match
  6247. /(?=abc){0}xyz/
  6248. xyz
  6249. 0: xyz
  6250. /(?=abc){1}xyz/
  6251. \= Expect no match
  6252. xyz
  6253. No match
  6254. /(?=(a))?./
  6255. ab
  6256. 0: a
  6257. bc
  6258. 0: b
  6259. /(?=(a))??./
  6260. ab
  6261. 0: a
  6262. bc
  6263. 0: b
  6264. /^(?=(a)){0}b(?1)/
  6265. backgammon
  6266. 0: ba
  6267. /^(?=(?1))?[az]([abc])d/
  6268. abd
  6269. 0: abd
  6270. zcdxx
  6271. 0: zcd
  6272. /^(?!a){0}\w+/
  6273. aaaaa
  6274. 0: aaaaa
  6275. /(?<=(abc))?xyz/
  6276. abcxyz
  6277. 0: xyz
  6278. pqrxyz
  6279. 0: xyz
  6280. /((?2))((?1))/
  6281. abc
  6282. Failed: error -52: nested recursion at the same subject position
  6283. /(?(R)a+|(?R)b)/
  6284. aaaabcde
  6285. 0: aaaab
  6286. /(?(R)a+|((?R))b)/
  6287. aaaabcde
  6288. 0: aaaab
  6289. /((?(R)a+|(?1)b))/
  6290. aaaabcde
  6291. 0: aaaab
  6292. /((?(R2)a+|(?1)b))()/
  6293. aaaabcde
  6294. Failed: error -40: backreference condition or recursion test is not supported for DFA matching
  6295. /(?(R)a*(?1)|((?R))b)/
  6296. aaaabcde
  6297. Failed: error -52: nested recursion at the same subject position
  6298. /(a+)/no_auto_possess
  6299. aaaa\=ovector=3
  6300. Matched, but offsets vector is too small to show all matches
  6301. 0: aaaa
  6302. 1: aaa
  6303. 2: aa
  6304. aaaa\=ovector=4
  6305. 0: aaaa
  6306. 1: aaa
  6307. 2: aa
  6308. 3: a
  6309. /^\R/
  6310. \r\=ps
  6311. 0: \x0d
  6312. \r\=ph
  6313. Partial match: \x0d
  6314. /^\R{2,3}x/
  6315. \r\=ps
  6316. Partial match: \x0d
  6317. \r\=ph
  6318. Partial match: \x0d
  6319. \r\r\=ps
  6320. Partial match: \x0d\x0d
  6321. \r\r\=ph
  6322. Partial match: \x0d\x0d
  6323. \r\r\r\=ps
  6324. Partial match: \x0d\x0d\x0d
  6325. \r\r\r\=ph
  6326. Partial match: \x0d\x0d\x0d
  6327. \r\rx
  6328. 0: \x0d\x0dx
  6329. \r\r\rx
  6330. 0: \x0d\x0d\x0dx
  6331. /^\R{2,3}?x/
  6332. \r\=ps
  6333. Partial match: \x0d
  6334. \r\=ph
  6335. Partial match: \x0d
  6336. \r\r\=ps
  6337. Partial match: \x0d\x0d
  6338. \r\r\=ph
  6339. Partial match: \x0d\x0d
  6340. \r\r\r\=ps
  6341. Partial match: \x0d\x0d\x0d
  6342. \r\r\r\=ph
  6343. Partial match: \x0d\x0d\x0d
  6344. \r\rx
  6345. 0: \x0d\x0dx
  6346. \r\r\rx
  6347. 0: \x0d\x0d\x0dx
  6348. /^\R?x/
  6349. \r\=ps
  6350. Partial match: \x0d
  6351. \r\=ph
  6352. Partial match: \x0d
  6353. x
  6354. 0: x
  6355. \rx
  6356. 0: \x0dx
  6357. /^\R+x/
  6358. \r\=ps
  6359. Partial match: \x0d
  6360. \r\=ph
  6361. Partial match: \x0d
  6362. \r\n\=ps
  6363. Partial match: \x0d\x0a
  6364. \r\n\=ph
  6365. Partial match: \x0d\x0a
  6366. \rx
  6367. 0: \x0dx
  6368. /^a$/newline=crlf
  6369. a\r\=ps
  6370. Partial match: a\x0d
  6371. a\r\=ph
  6372. Partial match: a\x0d
  6373. /^a$/m,newline=crlf
  6374. a\r\=ps
  6375. Partial match: a\x0d
  6376. a\r\=ph
  6377. Partial match: a\x0d
  6378. /^(a$|a\r)/newline=crlf
  6379. a\r\=ps
  6380. 0: a\x0d
  6381. a\r\=ph
  6382. Partial match: a\x0d
  6383. /^(a$|a\r)/m,newline=crlf
  6384. a\r\=ps
  6385. 0: a\x0d
  6386. a\r\=ph
  6387. Partial match: a\x0d
  6388. /./newline=crlf
  6389. \r\=ps
  6390. 0: \x0d
  6391. \r\=ph
  6392. Partial match: \x0d
  6393. /.{2,3}/newline=crlf
  6394. \r\=ps
  6395. Partial match: \x0d
  6396. \r\=ph
  6397. Partial match: \x0d
  6398. \r\r\=ps
  6399. 0: \x0d\x0d
  6400. \r\r\=ph
  6401. Partial match: \x0d\x0d
  6402. \r\r\r\=ps
  6403. 0: \x0d\x0d\x0d
  6404. \r\r\r\=ph
  6405. Partial match: \x0d\x0d\x0d
  6406. /.{2,3}?/newline=crlf
  6407. \r\=ps
  6408. Partial match: \x0d
  6409. \r\=ph
  6410. Partial match: \x0d
  6411. \r\r\=ps
  6412. 0: \x0d\x0d
  6413. \r\r\=ph
  6414. Partial match: \x0d\x0d
  6415. \r\r\r\=ps
  6416. 0: \x0d\x0d\x0d
  6417. 1: \x0d\x0d
  6418. \r\r\r\=ph
  6419. Partial match: \x0d\x0d\x0d
  6420. # Test simple validity check for restarts
  6421. /abcdef/
  6422. abc\=dfa_restart
  6423. Failed: error -38: invalid data in workspace for DFA restart
  6424. /<H((?(?!<H|F>)(.)|(?R))++)*F>/
  6425. text <H more text <H texting more hexA0-"\xA0" hex above 7F-"\xBC" F> text xxxxx <H text F> text F> text2 <H text sample F> more text.
  6426. 0: <H more text <H texting more hexA0-"\xa0" hex above 7F-"\xbc" F> text xxxxx <H text F> text F>
  6427. /^(?>.{4})abc|^\w\w.xabcd/
  6428. xxxxabcd
  6429. 0: xxxxabcd
  6430. 1: xxxxabc
  6431. xx\xa0xabcd
  6432. 0: xx\xa0xabcd
  6433. 1: xx\xa0xabc
  6434. /^(.{4}){2}+abc|^\w\w.x\w\w\w\wabcd/
  6435. xxxxxxxxabcd
  6436. 0: xxxxxxxxabcd
  6437. 1: xxxxxxxxabc
  6438. xx\xa0xxxxxabcd
  6439. 0: xx\xa0xxxxxabcd
  6440. 1: xx\xa0xxxxxabc
  6441. /abcd/
  6442. abcd\=ovector=0
  6443. 0: abcd
  6444. # These tests show up auto-possessification
  6445. /[ab]*/
  6446. aaaa
  6447. 0: aaaa
  6448. /[ab]*?/
  6449. aaaa
  6450. 0: aaaa
  6451. 1: aaa
  6452. 2: aa
  6453. 3: a
  6454. 4:
  6455. /[ab]?/
  6456. aaaa
  6457. 0: a
  6458. /[ab]??/
  6459. aaaa
  6460. 0: a
  6461. 1:
  6462. /[ab]+/
  6463. aaaa
  6464. 0: aaaa
  6465. /[ab]+?/
  6466. aaaa
  6467. 0: aaaa
  6468. 1: aaa
  6469. 2: aa
  6470. 3: a
  6471. /[ab]{2,3}/
  6472. aaaa
  6473. 0: aaa
  6474. /[ab]{2,3}?/
  6475. aaaa
  6476. 0: aaa
  6477. 1: aa
  6478. /[ab]{2,}/
  6479. aaaa
  6480. 0: aaaa
  6481. /[ab]{2,}?/
  6482. aaaa
  6483. 0: aaaa
  6484. 1: aaa
  6485. 2: aa
  6486. '\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++'
  6487. NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
  6488. 0: NON QUOTED "QUOT""ED" AFTER
  6489. '\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
  6490. NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
  6491. 0: NON QUOTED "QUOT""ED" AFTER
  6492. /abc(?=xyz)/allusedtext
  6493. abcxyzpqr
  6494. 0: abcxyz
  6495. >>>
  6496. abcxyzpqr\=aftertext
  6497. 0: abcxyz
  6498. >>>
  6499. 0+ xyzpqr
  6500. /(?<=pqr)abc(?=xyz)/allusedtext
  6501. xyzpqrabcxyzpqr
  6502. 0: pqrabcxyz
  6503. <<< >>>
  6504. xyzpqrabcxyzpqr\=aftertext
  6505. 0: pqrabcxyz
  6506. <<< >>>
  6507. 0+ xyzpqr
  6508. /a\b/
  6509. a.\=allusedtext
  6510. 0: a.
  6511. >
  6512. a\=allusedtext
  6513. 0: a
  6514. /abc(?=abcde)(?=ab)/allusedtext
  6515. abcabcdefg
  6516. 0: abcabcde
  6517. >>>>>
  6518. /a*?b*?/
  6519. ab
  6520. 0: ab
  6521. 1: a
  6522. 2:
  6523. /(*NOTEMPTY)a*?b*?/
  6524. ab
  6525. 0: ab
  6526. 1: a
  6527. ba
  6528. 0: b
  6529. cb
  6530. 0: b
  6531. /(*NOTEMPTY_ATSTART)a*?b*?/aftertext
  6532. ab
  6533. 0: ab
  6534. 0+
  6535. 1: a
  6536. cdab
  6537. 0:
  6538. 0+ dab
  6539. /(a)(b)|(c)/
  6540. XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
  6541. 0: c
  6542. Get substring 1 failed (-55): requested value is not set
  6543. Get substring 2 failed (-54): requested value is not available
  6544. Get substring 3 failed (-54): requested value is not available
  6545. Get substring 4 failed (-54): requested value is not available
  6546. 0L c
  6547. /(?<A>aa)/
  6548. aa\=get=A
  6549. 0: aa
  6550. Get substring 'A' failed (-41): function is not supported for DFA matching
  6551. aa\=copy=A
  6552. 0: aa
  6553. Copy substring 'A' failed (-41): function is not supported for DFA matching
  6554. /a+/no_auto_possess
  6555. a\=ovector=2,get=1,get=2,getall
  6556. 0: a
  6557. Get substring 1 failed (-55): requested value is not set
  6558. Get substring 2 failed (-54): requested value is not available
  6559. 0L a
  6560. aaa\=ovector=2,get=1,get=2,getall
  6561. Matched, but offsets vector is too small to show all matches
  6562. 0: aaa
  6563. 1: aa
  6564. 1G aa (2)
  6565. Get substring 2 failed (-54): requested value is not available
  6566. 0L aaa
  6567. 1L aa
  6568. /a(b)c(d)/
  6569. abc\=ph,copy=0,copy=1,getall
  6570. Partial match: abc
  6571. 0C abc (3)
  6572. Copy substring 1 failed (-2): partial match
  6573. get substring list failed (-2): partial match
  6574. /ab(?C" any text with spaces ")cde/B
  6575. ------------------------------------------------------------------
  6576. Bra
  6577. ab
  6578. CalloutStr " any text with spaces " 6 30 1
  6579. cde
  6580. Ket
  6581. End
  6582. ------------------------------------------------------------------
  6583. abcde
  6584. Callout (6): " any text with spaces "
  6585. --->abcde
  6586. ^ ^ c
  6587. 0: abcde
  6588. 12abcde
  6589. Callout (6): " any text with spaces "
  6590. --->12abcde
  6591. ^ ^ c
  6592. 0: abcde
  6593. /^a(b)c(?C1)def/
  6594. abcdef
  6595. --->abcdef
  6596. 1 ^ ^ d
  6597. 0: abcdef
  6598. /^a(b)c(?C"AB")def/
  6599. abcdef
  6600. Callout (10): "AB"
  6601. --->abcdef
  6602. ^ ^ d
  6603. 0: abcdef
  6604. /^a(b)c(?C1)def/
  6605. abcdef\=callout_capture
  6606. Callout 1: last capture = 0
  6607. --->abcdef
  6608. ^ ^ d
  6609. 0: abcdef
  6610. /^a(b)c(?C{AB})def/B
  6611. ------------------------------------------------------------------
  6612. Bra
  6613. ^
  6614. a
  6615. CBra 1
  6616. b
  6617. Ket
  6618. c
  6619. CalloutStr {AB} 10 14 1
  6620. def
  6621. Ket
  6622. End
  6623. ------------------------------------------------------------------
  6624. abcdef\=callout_capture
  6625. Callout (10): {AB} last capture = 0
  6626. --->abcdef
  6627. ^ ^ d
  6628. 0: abcdef
  6629. /^(?(?C25)(?=abc)abcd|xyz)/B
  6630. ------------------------------------------------------------------
  6631. Bra
  6632. ^
  6633. Cond
  6634. Callout 25 9 3
  6635. Assert
  6636. abc
  6637. Ket
  6638. abcd
  6639. Alt
  6640. xyz
  6641. Ket
  6642. Ket
  6643. End
  6644. ------------------------------------------------------------------
  6645. abcdefg
  6646. --->abcdefg
  6647. 25 ^ (?=
  6648. 0: abcd
  6649. xyz123
  6650. --->xyz123
  6651. 25 ^ (?=
  6652. 0: xyz
  6653. /^(?(?C$abc$)(?=abc)abcd|xyz)/B
  6654. ------------------------------------------------------------------
  6655. Bra
  6656. ^
  6657. Cond
  6658. CalloutStr $abc$ 7 12 3
  6659. Assert
  6660. abc
  6661. Ket
  6662. abcd
  6663. Alt
  6664. xyz
  6665. Ket
  6666. Ket
  6667. End
  6668. ------------------------------------------------------------------
  6669. abcdefg
  6670. Callout (7): $abc$
  6671. --->abcdefg
  6672. ^ (?=
  6673. 0: abcd
  6674. xyz123
  6675. Callout (7): $abc$
  6676. --->xyz123
  6677. ^ (?=
  6678. 0: xyz
  6679. /^ab(?C'first')cd(?C"second")ef/
  6680. abcdefg
  6681. Callout (7): 'first'
  6682. --->abcdefg
  6683. ^ ^ c
  6684. Callout (20): "second"
  6685. --->abcdefg
  6686. ^ ^ e
  6687. 0: abcdef
  6688. /(?:a(?C`code`)){3}X/
  6689. aaaXY
  6690. Callout (8): `code`
  6691. --->aaaXY
  6692. ^^ ){3}
  6693. Callout (8): `code`
  6694. --->aaaXY
  6695. ^ ^ ){3}
  6696. Callout (8): `code`
  6697. --->aaaXY
  6698. ^ ^ ){3}
  6699. 0: aaaX
  6700. # Binary zero in callout string
  6701. /"a(?C'x" 00 "z')b"/hex
  6702. abcdefgh
  6703. Callout (5): 'x\x00z'
  6704. --->abcdefgh
  6705. ^^ b
  6706. 0: ab
  6707. /(?(?!)a|b)/
  6708. bbb
  6709. 0: b
  6710. \= Expect no match
  6711. aaa
  6712. No match
  6713. /^/gm
  6714. \n\n\n
  6715. 0:
  6716. 0:
  6717. 0:
  6718. /^/gm,alt_circumflex
  6719. \n\n\n
  6720. 0:
  6721. 0:
  6722. 0:
  6723. 0:
  6724. /abc/use_offset_limit
  6725. 1234abcde\=offset_limit=100
  6726. 0: abc
  6727. 1234abcde\=offset_limit=9
  6728. 0: abc
  6729. 1234abcde\=offset_limit=4
  6730. 0: abc
  6731. 1234abcde\=offset_limit=4,offset=4
  6732. 0: abc
  6733. \= Expect no match
  6734. 1234abcde\=offset_limit=4,offset=5
  6735. No match
  6736. 1234abcde\=offset_limit=3
  6737. No match
  6738. /(?<=abc)/use_offset_limit
  6739. 1234abc\=offset_limit=7
  6740. 0:
  6741. \= Expect no match
  6742. 1234abc\=offset_limit=6
  6743. No match
  6744. /abcd/null_context
  6745. abcd\=null_context
  6746. 0: abcd
  6747. /()()a+/no_auto_possess
  6748. aaa\=allcaptures
  6749. ** Ignored for DFA matching: allcaptures
  6750. 0: aaa
  6751. 1: aa
  6752. 2: a
  6753. a\=allcaptures
  6754. ** Ignored for DFA matching: allcaptures
  6755. 0: a
  6756. /(*LIMIT_DEPTH=100)^((.)(?1)|.)$/
  6757. \= Expect depth limit exceeded
  6758. a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
  6759. Failed: error -53: matching depth limit exceeded
  6760. /(*LIMIT_HEAP=0)^((.)(?1)|.)$/
  6761. \= Expect heap limit exceeded
  6762. a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
  6763. Failed: error -63: heap limit exceeded
  6764. /(*LIMIT_HEAP=50000)^((.)(?1)|.)$/
  6765. \= Expect success
  6766. a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
  6767. 0: a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
  6768. /(02-)?[0-9]{3}-[0-9]{3}/
  6769. 02-123-123
  6770. 0: 02-123-123
  6771. /^(a(?2))(b)(?1)/
  6772. abbab\=find_limits
  6773. Minimum heap limit = 0
  6774. Minimum match limit = 4
  6775. Minimum depth limit = 2
  6776. 0: abbab
  6777. /abc/endanchored
  6778. xyzabc
  6779. 0: abc
  6780. \= Expect no match
  6781. xyzabcdef
  6782. No match
  6783. \= Expect error
  6784. xyzabc\=ph
  6785. Failed: error -34: bad option value
  6786. /abc/
  6787. xyzabc\=endanchored
  6788. 0: abc
  6789. \= Expect no match
  6790. xyzabcdef\=endanchored
  6791. No match
  6792. \= Expect error
  6793. xyzabc\=ps,endanchored
  6794. Failed: error -34: bad option value
  6795. /abc|bcd/endanchored
  6796. xyzabcd
  6797. 0: bcd
  6798. \= Expect no match
  6799. xyzabcdef
  6800. No match
  6801. /(*NUL)^.*/
  6802. a\nb\x00ccc
  6803. 0: a\x0ab
  6804. /(*NUL)^.*/s
  6805. a\nb\x00ccc
  6806. 0: a\x0ab\x00ccc
  6807. /^x/m,newline=nul
  6808. ab\x00xy
  6809. 0: x
  6810. /'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex
  6811. x\nyz
  6812. 0: x\x0ay
  6813. /(*NUL)^X\NY/
  6814. X\nY
  6815. 0: X\x0aY
  6816. X\rY
  6817. 0: X\x0dY
  6818. \= Expect no match
  6819. X\x00Y
  6820. No match
  6821. /(?<=abc|)/
  6822. abcde\=aftertext
  6823. 0:
  6824. 0+ abcde
  6825. /(?<=|abc)/
  6826. abcde\=aftertext
  6827. 0:
  6828. 0+ abcde
  6829. /(?<=abc|)/endanchored
  6830. abcde\=aftertext
  6831. 0:
  6832. 0+
  6833. /(?<=|abc)/endanchored
  6834. abcde\=aftertext
  6835. 0:
  6836. 0+
  6837. /(*LIMIT_MATCH=100).*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00 \x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););/no_dotstar_anchor
  6838. \= Expect limit exceeded
  6839. .*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00 \x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););
  6840. Failed: error -47: match limit exceeded
  6841. /\n/firstline
  6842. xyz\nabc
  6843. 0: \x0a
  6844. /\nabc/firstline
  6845. xyz\nabc
  6846. 0: \x0aabc
  6847. /\x{0a}abc/firstline,newline=crlf
  6848. \= Expect no match
  6849. xyz\r\nabc
  6850. No match
  6851. /[abc]/firstline
  6852. \= Expect no match
  6853. \na
  6854. No match
  6855. /foobar/
  6856. the foobar thing\=copy_matched_subject
  6857. 0: foobar
  6858. the foobar thing\=copy_matched_subject,zero_terminate
  6859. 0: foobar
  6860. /foobar/g
  6861. the foobar thing foobar again\=copy_matched_subject
  6862. 0: foobar
  6863. 0: foobar
  6864. /(?(VERSION>=0)^B0W)/
  6865. B0W-W0W
  6866. 0: B0W
  6867. \= Expect no match
  6868. 0
  6869. No match
  6870. /(?(VERSION>=1000)^B0W|W0W)/
  6871. B0W-W0W
  6872. 0: W0W
  6873. \= Expect no match
  6874. 0
  6875. No match
  6876. /(?<=pqr)abc(?=xyz)/
  6877. 123pqrabcxy\=ps,allusedtext
  6878. Partial match: pqrabcxy
  6879. <<<
  6880. 123pqrabcxyz\=ps,allusedtext
  6881. 0: pqrabcxyz
  6882. <<< >>>
  6883. /(?>a+b)/
  6884. aaaa\=ps
  6885. Partial match: aaaa
  6886. aaaab\=ps
  6887. 0: aaaab
  6888. /(abc)(?1)/
  6889. abca\=ps
  6890. Partial match: abca
  6891. abcabc\=ps
  6892. 0: abcabc
  6893. /(?(?=abc).*|Z)/
  6894. ab\=ps
  6895. Partial match: ab
  6896. abcxyz\=ps
  6897. 0: abcxyz
  6898. /(abc)++x/
  6899. abcab\=ps
  6900. Partial match: abcab
  6901. abc\=ps
  6902. Partial match: abc
  6903. ab\=ps
  6904. Partial match: ab
  6905. abcx
  6906. 0: abcx
  6907. /\z/
  6908. abc\=ph
  6909. Partial match:
  6910. abc\=ps
  6911. 0:
  6912. /\Z/
  6913. abc\=ph
  6914. Partial match:
  6915. abc\=ps
  6916. 0:
  6917. abc\n\=ph
  6918. Partial match: \x0a
  6919. abc\n\=ps
  6920. 0:
  6921. /c*+(?<=[bc])/
  6922. abc\=ph
  6923. Partial match: c
  6924. ab\=ph
  6925. Partial match:
  6926. abc\=ps
  6927. 0: c
  6928. ab\=ps
  6929. 0:
  6930. /c++(?<=[bc])/
  6931. abc\=ph
  6932. Partial match: c
  6933. ab\=ph
  6934. Partial match:
  6935. /(?<=(?=.(?<=x)))/
  6936. abx
  6937. 0:
  6938. ab\=ph
  6939. Partial match:
  6940. bxyz
  6941. 0:
  6942. xyz
  6943. 0:
  6944. /(?![ab]).*/
  6945. ab\=ph
  6946. Partial match:
  6947. /c*+/
  6948. ab\=ph,offset=2
  6949. Partial match:
  6950. /
  6951. /anchored, firstline
  6952. \x0a
  6953. 0: \x0a
  6954. /
  6955. /anchored,firstline,no_start_optimize
  6956. \x0a
  6957. 0: \x0a
  6958. /
  6959. /firstline
  6960. \x0a
  6961. 0: \x0a
  6962. abc\x0adef
  6963. 0: \x0a
  6964. /|a(?0)/endanchored
  6965. aaaa
  6966. 0: aaaa
  6967. 1: aaa
  6968. 2: aa
  6969. 3: a
  6970. 4:
  6971. # End of testinput6