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.

6114 lines
104 KiB

  1. # This set of tests is not Perl-compatible. It checks on special features
  2. # of PCRE2's API, error diagnostics, and the compiled code of some patterns.
  3. # It also checks the non-Perl syntax that PCRE2 supports (Python, .NET,
  4. # Oniguruma). There are also some tests where PCRE2 and Perl differ,
  5. # either because PCRE2 can't be compatible, or there is a possible Perl
  6. # bug.
  7. # NOTE: This is a non-UTF set of tests. When UTF support is needed, use
  8. # test 5.
  9. #forbid_utf
  10. #newline_default lf any anycrlf
  11. # Test binary zeroes in the pattern
  12. # /a\0B/ where 0 is a binary zero
  13. /61 5c 00 62/B,hex
  14. a\x{0}b
  15. # /a0b/ where 0 is a binary zero
  16. /61 00 62/B,hex
  17. a\x{0}b
  18. # /(?#B0C)DE/ where 0 is a binary zero
  19. /28 3f 23 42 00 43 29 44 45/B,hex
  20. DE
  21. /(a)b|/I
  22. /abc/I
  23. abc
  24. defabc
  25. abc\=anchored
  26. \= Expect no match
  27. defabc\=anchored
  28. ABC
  29. /^abc/I
  30. abc
  31. abc\=anchored
  32. \= Expect no match
  33. defabc
  34. defabc\=anchored
  35. /a+bc/I
  36. /a*bc/I
  37. /a{3}bc/I
  38. /(abc|a+z)/I
  39. /^abc$/I
  40. abc
  41. \= Expect no match
  42. def\nabc
  43. /ab\idef/
  44. /(?X)ab\idef/
  45. /x{5,4}/
  46. /z{65536}/
  47. /[abcd/
  48. /[\B]/B
  49. /[\R]/B
  50. /[\X]/B
  51. /[z-a]/
  52. /^*/
  53. /(abc/
  54. /(?# abc/
  55. /(?z)abc/
  56. /.*b/I
  57. /.*?b/I
  58. /cat|dog|elephant/I
  59. this sentence eventually mentions a cat
  60. this sentences rambles on and on for a while and then reaches elephant
  61. /cat|dog|elephant/I
  62. this sentence eventually mentions a cat
  63. this sentences rambles on and on for a while and then reaches elephant
  64. /cat|dog|elephant/Ii
  65. this sentence eventually mentions a CAT cat
  66. this sentences rambles on and on for a while to elephant ElePhant
  67. /a|[bcd]/I
  68. /(a|[^\dZ])/I
  69. /(a|b)*[\s]/I
  70. /(ab\2)/
  71. /{4,5}abc/
  72. /(a)(b)(c)\2/I
  73. abcb
  74. abcb\=ovector=0
  75. abcb\=ovector=1
  76. abcb\=ovector=2
  77. abcb\=ovector=3
  78. abcb\=ovector=4
  79. /(a)bc|(a)(b)\2/I
  80. abc
  81. abc\=ovector=0
  82. abc\=ovector=1
  83. abc\=ovector=2
  84. aba
  85. aba\=ovector=0
  86. aba\=ovector=1
  87. aba\=ovector=2
  88. aba\=ovector=3
  89. aba\=ovector=4
  90. /abc$/I,dollar_endonly
  91. abc
  92. \= Expect no match
  93. abc\n
  94. abc\ndef
  95. /(a)(b)(c)(d)(e)\6/
  96. /the quick brown fox/I
  97. the quick brown fox
  98. this is a line with the quick brown fox
  99. /the quick brown fox/I,anchored
  100. the quick brown fox
  101. \= Expect no match
  102. this is a line with the quick brown fox
  103. /ab(?z)cd/
  104. /^abc|def/I
  105. abcdef
  106. abcdef\=notbol
  107. /.*((abc)$|(def))/I
  108. defabc
  109. defabc\=noteol
  110. /)/
  111. /a[]b/
  112. /[^aeiou ]{3,}/I
  113. co-processors, and for
  114. /<.*>/I
  115. abc<def>ghi<klm>nop
  116. /<.*?>/I
  117. abc<def>ghi<klm>nop
  118. /<.*>/I,ungreedy
  119. abc<def>ghi<klm>nop
  120. /(?U)<.*>/I
  121. abc<def>ghi<klm>nop
  122. /<.*?>/I,ungreedy
  123. abc<def>ghi<klm>nop
  124. /={3,}/I,ungreedy
  125. abc========def
  126. /(?U)={3,}?/I
  127. abc========def
  128. /(?<!bar|cattle)foo/I
  129. foo
  130. catfoo
  131. \= Expect no match
  132. the barfoo
  133. and cattlefoo
  134. /abc(?<=a+)b/
  135. /(?<!(foo)a\1)bar/
  136. /(?i)abc/I
  137. /(a|(?m)a)/I
  138. /(?i)^1234/I
  139. /(^b|(?i)^d)/I
  140. /(?s).*/I
  141. /[abcd]/I
  142. /(?i)[abcd]/I
  143. /(?m)[xy]|(b|c)/I
  144. /(^a|^b)/Im
  145. /(?i)(^a|^b)/Im
  146. /(a)(?(1)a|b|c)/
  147. /(?(?=a)a|b|c)/
  148. /(?(1a)/
  149. /(?(1a))/
  150. /(?(?i))/
  151. /(?(abc))/
  152. /(?(?<ab))/
  153. /((?s)blah)\s+\1/I
  154. /((?i)blah)\s+\1/I
  155. /((?i)b)/IB
  156. /(a*b|(?i:c*(?-i)d))/I
  157. /a$/I
  158. a
  159. a\n
  160. \= Expect no match
  161. a\=noteol
  162. a\n\=noteol
  163. /a$/Im
  164. a
  165. a\n
  166. a\n\=noteol
  167. \= Expect no match
  168. a\=noteol
  169. /\Aabc/Im
  170. /^abc/Im
  171. /^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/I
  172. aaaaabbbbbcccccdef
  173. /(?<=foo)[ab]/I
  174. /(?<!foo)(alpha|omega)/I
  175. /(?!alphabet)[ab]/I
  176. /(?<=foo\n)^bar/Im
  177. foo\nbarbar
  178. \= Expect no match
  179. rhubarb
  180. barbell
  181. abc\nbarton
  182. /^(?<=foo\n)bar/Im
  183. foo\nbarbar
  184. \= Expect no match
  185. rhubarb
  186. barbell
  187. abc\nbarton
  188. /(?>^abc)/Im
  189. abc
  190. def\nabc
  191. \= Expect no match
  192. defabc
  193. /(?<=ab(c+)d)ef/
  194. /(?<=ab(?<=c+)d)ef/
  195. /The next three are in testinput2 because they have variable length branches/
  196. /(?<=bullock|donkey)-cart/I
  197. the bullock-cart
  198. a donkey-cart race
  199. \= Expect no match
  200. cart
  201. horse-and-cart
  202. /(?<=ab(?i)x|y|z)/I
  203. /(?>.*)(?<=(abcd)|(xyz))/I
  204. alphabetabcd
  205. endingxyz
  206. /(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/I
  207. abxyZZ
  208. abXyZZ
  209. ZZZ
  210. zZZ
  211. bZZ
  212. BZZ
  213. \= Expect no match
  214. ZZ
  215. abXYZZ
  216. zzz
  217. bzz
  218. /(?<!(foo)a)bar/I
  219. bar
  220. foobbar
  221. \= Expect no match
  222. fooabar
  223. # Perl does not fail these two for the final subjects.
  224. /^(xa|=?\1a){2}$/
  225. xa=xaa
  226. \= Expect no match
  227. xa=xaaa
  228. /^(xa|=?\1a)+$/
  229. xa=xaa
  230. \= Expect no match
  231. xa=xaaa
  232. # These are syntax tests from Perl 5.005
  233. /a[b-a]/
  234. /a[]b/
  235. /a[/
  236. /*a/
  237. /(*)b/
  238. /abc)/
  239. /(abc/
  240. /a**/
  241. /)(/
  242. /\1/
  243. /\2/
  244. /(a)|\2/
  245. /a[b-a]/Ii
  246. /a[]b/Ii
  247. /a[/Ii
  248. /*a/Ii
  249. /(*)b/Ii
  250. /abc)/Ii
  251. /(abc/Ii
  252. /a**/Ii
  253. /)(/Ii
  254. /:(?:/
  255. /(?<%)b/
  256. /a(?{)b/
  257. /a(?{{})b/
  258. /a(?{}})b/
  259. /a(?{"{"})b/
  260. /a(?{"{"}})b/
  261. /(?(1?)a|b)/
  262. /[a[:xyz:/
  263. /(?<=x+)y/
  264. /a{37,17}/
  265. /abc/\
  266. /abc/\i
  267. /(a)bc(d)/I
  268. abcd
  269. abcd\=copy=2
  270. abcd\=copy=5
  271. /(.{20})/I
  272. abcdefghijklmnopqrstuvwxyz
  273. abcdefghijklmnopqrstuvwxyz\=copy=1
  274. abcdefghijklmnopqrstuvwxyz\=get=1
  275. /(.{15})/I
  276. abcdefghijklmnopqrstuvwxyz
  277. abcdefghijklmnopqrstuvwxyz\=copy=1,get=1
  278. /(.{16})/I
  279. abcdefghijklmnopqrstuvwxyz
  280. abcdefghijklmnopqrstuvwxyz\=copy=1,get=1,getall
  281. /^(a|(bc))de(f)/I
  282. adef\=get=1,get=2,get=3,get=4,getall
  283. bcdef\=get=1,get=2,get=3,get=4,getall
  284. adefghijk\=copy=0
  285. /^abc\00def/I
  286. abc\00def\=copy=0,getall
  287. /word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
  288. )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
  289. )?)?)?)?)?)?)?)?)?otherword/I
  290. /.*X/IB
  291. /.*X/IBs
  292. /(.*X|^B)/IB
  293. /(.*X|^B)/IBs
  294. /(?s)(.*X|^B)/IB
  295. /(?s:.*X|^B)/IB
  296. /\Biss\B/I,aftertext
  297. Mississippi
  298. /iss/I,aftertext,altglobal
  299. Mississippi
  300. /\Biss\B/I,aftertext,altglobal
  301. Mississippi
  302. /\Biss\B/Ig,aftertext
  303. Mississippi
  304. \= Expect no match
  305. Mississippi\=anchored
  306. /(?<=[Ms])iss/Ig,aftertext
  307. Mississippi
  308. /(?<=[Ms])iss/I,aftertext,altglobal
  309. Mississippi
  310. /^iss/Ig,aftertext
  311. ississippi
  312. /.*iss/Ig,aftertext
  313. abciss\nxyzisspqr
  314. /.i./Ig,aftertext
  315. Mississippi
  316. Mississippi\=anchored
  317. Missouri river
  318. Missouri river\=anchored
  319. /^.is/Ig,aftertext
  320. Mississippi
  321. /^ab\n/Ig,aftertext
  322. ab\nab\ncd
  323. /^ab\n/Igm,aftertext
  324. ab\nab\ncd
  325. /^/gm,newline=any
  326. a\rb\nc\r\nxyz\=aftertext
  327. /abc/I
  328. /abc|bac/I
  329. /(abc|bac)/I
  330. /(abc|(c|dc))/I
  331. /(abc|(d|de)c)/I
  332. /a*/I
  333. /a+/I
  334. /(baa|a+)/I
  335. /a{0,3}/I
  336. /baa{3,}/I
  337. /"([^\\"]+|\\.)*"/I
  338. /(abc|ab[cd])/I
  339. /(a|.)/I
  340. /a|ba|\w/I
  341. /abc(?=pqr)/I
  342. /...(?<=abc)/I
  343. /abc(?!pqr)/I
  344. /ab./I
  345. /ab[xyz]/I
  346. /abc*/I
  347. /ab.c*/I
  348. /a.c*/I
  349. /.c*/I
  350. /ac*/I
  351. /(a.c*|b.c*)/I
  352. /a.c*|aba/I
  353. /.+a/I
  354. /(?=abcda)a.*/I
  355. /(?=a)a.*/I
  356. /a(b)*/I
  357. /a\d*/I
  358. /ab\d*/I
  359. /a(\d)*/I
  360. /abcde{0,0}/I
  361. /ab\d+/I
  362. /a(?(1)b)(.)/I
  363. /a(?(1)bag|big)(.)/I
  364. /a(?(1)bag|big)*(.)/I
  365. /a(?(1)bag|big)+(.)/I
  366. /a(?(1)b..|b..)(.)/I
  367. /ab\d{0}e/I
  368. /a?b?/I
  369. a
  370. b
  371. ab
  372. \
  373. \= Expect no match
  374. \=notempty
  375. /|-/I
  376. abcd
  377. -abc
  378. ab-c\=notempty
  379. \= Expect no match
  380. abc\=notempty
  381. /^.?abcd/I
  382. /\( # ( at start
  383. (?: # Non-capturing bracket
  384. (?>[^()]+) # Either a sequence of non-brackets (no backtracking)
  385. | # Or
  386. (?R) # Recurse - i.e. nested bracketed string
  387. )* # Zero or more contents
  388. \) # Closing )
  389. /Ix
  390. (abcd)
  391. (abcd)xyz
  392. xyz(abcd)
  393. (ab(xy)cd)pqr
  394. (ab(xycd)pqr
  395. () abc ()
  396. 12(abcde(fsh)xyz(foo(bar))lmno)89
  397. \= Expect no match
  398. abcd
  399. abcd)
  400. (abcd
  401. /\( ( (?>[^()]+) | (?R) )* \) /Igx
  402. (ab(xy)cd)pqr
  403. 1(abcd)(x(y)z)pqr
  404. /\( (?: (?>[^()]+) | (?R) ) \) /Ix
  405. (abcd)
  406. (ab(xy)cd)
  407. (a(b(c)d)e)
  408. ((ab))
  409. \= Expect no match
  410. ()
  411. /\( (?: (?>[^()]+) | (?R) )? \) /Ix
  412. ()
  413. 12(abcde(fsh)xyz(foo(bar))lmno)89
  414. /\( ( (?>[^()]+) | (?R) )* \) /Ix
  415. (ab(xy)cd)
  416. /\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
  417. (ab(xy)cd)
  418. /\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix
  419. (ab(xy)cd)
  420. (123ab(xy)cd)
  421. /\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix
  422. (ab(xy)cd)
  423. (123ab(xy)cd)
  424. /\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
  425. (ab(xy)cd)
  426. /\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
  427. (abcd(xyz<p>qrs)123)
  428. /\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
  429. (ab(cd)ef)
  430. (ab(cd(ef)gh)ij)
  431. /^[[:alnum:]]/IB
  432. /^[[:^alnum:]]/IB
  433. /^[[:alpha:]]/IB
  434. /^[[:^alpha:]]/IB
  435. /[_[:alpha:]]/I
  436. /^[[:ascii:]]/IB
  437. /^[[:^ascii:]]/IB
  438. /^[[:blank:]]/IB
  439. /^[[:^blank:]]/IB
  440. /[\n\x0b\x0c\x0d[:blank:]]/I
  441. /^[[:cntrl:]]/IB
  442. /^[[:digit:]]/IB
  443. /^[[:graph:]]/IB
  444. /^[[:lower:]]/IB
  445. /^[[:print:]]/IB
  446. /^[[:punct:]]/IB
  447. /^[[:space:]]/IB
  448. /^[[:upper:]]/IB
  449. /^[[:xdigit:]]/IB
  450. /^[[:word:]]/IB
  451. /^[[:^cntrl:]]/IB
  452. /^[12[:^digit:]]/IB
  453. /^[[:^blank:]]/IB
  454. /[01[:alpha:]%]/IB
  455. /[[.ch.]]/I
  456. /[[=ch=]]/I
  457. /[[:rhubarb:]]/I
  458. /[[:upper:]]/Ii
  459. A
  460. a
  461. /[[:lower:]]/Ii
  462. A
  463. a
  464. /((?-i)[[:lower:]])[[:lower:]]/Ii
  465. ab
  466. aB
  467. \= Expect no match
  468. Ab
  469. AB
  470. /[\200-\110]/I
  471. /^(?(0)f|b)oo/I
  472. # This one's here because of the large output vector needed
  473. /(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/I
  474. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC\=ovector=300
  475. # This one's here because Perl does this differently and PCRE2 can't at present
  476. /(main(O)?)+/I
  477. mainmain
  478. mainOmain
  479. # These are all cases where Perl does it differently (nested captures)
  480. /^(a(b)?)+$/I
  481. aba
  482. /^(aa(bb)?)+$/I
  483. aabbaa
  484. /^(aa|aa(bb))+$/I
  485. aabbaa
  486. /^(aa(bb)??)+$/I
  487. aabbaa
  488. /^(?:aa(bb)?)+$/I
  489. aabbaa
  490. /^(aa(b(b))?)+$/I
  491. aabbaa
  492. /^(?:aa(b(b))?)+$/I
  493. aabbaa
  494. /^(?:aa(b(?:b))?)+$/I
  495. aabbaa
  496. /^(?:aa(bb(?:b))?)+$/I
  497. aabbbaa
  498. /^(?:aa(b(?:bb))?)+$/I
  499. aabbbaa
  500. /^(?:aa(?:b(b))?)+$/I
  501. aabbaa
  502. /^(?:aa(?:b(bb))?)+$/I
  503. aabbbaa
  504. /^(aa(b(bb))?)+$/I
  505. aabbbaa
  506. /^(aa(bb(bb))?)+$/I
  507. aabbbbaa
  508. # ----------------
  509. /#/IBx
  510. /a#/IBx
  511. /[\s]/IB
  512. /[\S]/IB
  513. /a(?i)b/IB
  514. ab
  515. aB
  516. \= Expect no match
  517. AB
  518. /(a(?i)b)/IB
  519. ab
  520. aB
  521. \= Expect no match
  522. AB
  523. / (?i)abc/IBx
  524. /#this is a comment
  525. (?i)abc/IBx
  526. /123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB
  527. /\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB
  528. /\Q\E/IB
  529. \
  530. /\Q\Ex/IB
  531. / \Q\E/IB
  532. /a\Q\E/IB
  533. abc
  534. bca
  535. bac
  536. /a\Q\Eb/IB
  537. abc
  538. /\Q\Eabc/IB
  539. /x*+\w/IB
  540. \= Expect no match
  541. xxxxx
  542. /x?+/IB
  543. /x++/IB
  544. /x{1,3}+/B,no_auto_possess
  545. /x{1,3}+/Bi,no_auto_possess
  546. /[^x]{1,3}+/B,no_auto_possess
  547. /[^x]{1,3}+/Bi,no_auto_possess
  548. /(x)*+/IB
  549. /^(\w++|\s++)*$/I
  550. now is the time for all good men to come to the aid of the party
  551. \= Expect no match
  552. this is not a line with only words and spaces!
  553. /(\d++)(\w)/I
  554. 12345a
  555. \= Expect no match
  556. 12345+
  557. /a++b/I
  558. aaab
  559. /(a++b)/I
  560. aaab
  561. /(a++)b/I
  562. aaab
  563. /([^()]++|\([^()]*\))+/I
  564. ((abc(ade)ufh()()x
  565. /\(([^()]++|\([^()]+\))+\)/I
  566. (abc)
  567. (abc(def)xyz)
  568. \= Expect no match
  569. ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  570. /(abc){1,3}+/IB
  571. /a+?+/I
  572. /a{2,3}?+b/I
  573. /(?U)a+?+/I
  574. /a{2,3}?+b/I,ungreedy
  575. /x(?U)a++b/IB
  576. xaaaab
  577. /(?U)xa++b/IB
  578. xaaaab
  579. /^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/IB
  580. /^x(?U)a+b/IB
  581. /^x(?U)(a+)b/IB
  582. /[.x.]/I
  583. /[=x=]/I
  584. /[:x:]/I
  585. /\F/I
  586. /\l/I
  587. /\L/I
  588. /\N{name}/I
  589. /\u/I
  590. /\U/I
  591. /\N{4}/
  592. abcdefg
  593. /\N{,}/
  594. /\N{25,ab}/
  595. /a{1,3}b/ungreedy
  596. ab
  597. /[/I
  598. /[a-/I
  599. /[[:space:]/I
  600. /[\s]/IB
  601. /[[:space:]]/IB
  602. /[[:space:]abcde]/IB
  603. /< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/Ix
  604. <>
  605. <abcd>
  606. <abc <123> hij>
  607. <abc <def> hij>
  608. <abc<>def>
  609. <abc<>
  610. \= Expect no match
  611. <abc
  612. /8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b/IB
  613. /\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b/IB
  614. /(.*)\d+\1/I
  615. /(.*)\d+/I
  616. /(.*)\d+\1/Is
  617. /(.*)\d+/Is
  618. /(.*(xyz))\d+\2/I
  619. /((.*))\d+\1/I
  620. abc123bc
  621. /a[b]/I
  622. /(?=a).*/I
  623. /(?=abc).xyz/Ii
  624. /(?=abc)(?i).xyz/I
  625. /(?=a)(?=b)/I
  626. /(?=.)a/I
  627. /((?=abcda)a)/I
  628. /((?=abcda)ab)/I
  629. /()a/I
  630. /(?:(?=.)|(?<!x))a/I
  631. /(?(1)ab|ac)(.)/I
  632. /(?(1)abz|acz)(.)/I
  633. /(?(1)abz)(.)/I
  634. /(?(1)abz)(1)23/I
  635. /(a)+/I
  636. /(a){2,3}/I
  637. /(a)*/I
  638. /[a]/I
  639. /[ab]/I
  640. /[ab]/I
  641. /[^a]/I
  642. /\d456/I
  643. /\d456/I
  644. /a^b/I
  645. /^a/Im
  646. abcde
  647. xy\nabc
  648. \= Expect no match
  649. xyabc
  650. /c|abc/I
  651. /(?i)[ab]/I
  652. /[ab](?i)cd/I
  653. /abc(?C)def/I
  654. abcdef
  655. 1234abcdef
  656. \= Expect no match
  657. abcxyz
  658. abcxyzf
  659. /abc(?C)de(?C1)f/I
  660. 123abcdef
  661. /(?C1)\dabc(?C2)def/I
  662. 1234abcdef
  663. \= Expect no match
  664. abcdef
  665. /(?C1)\dabc(?C2)def/I
  666. 1234abcdef
  667. \= Expect no match
  668. abcdef
  669. /(?C255)ab/I
  670. /(?C256)ab/I
  671. /(?Cab)xx/I
  672. /(?C12vr)x/I
  673. /abc(?C)def/I
  674. \x83\x0\x61bcdef
  675. /(abc)(?C)de(?C1)f/I
  676. 123abcdef
  677. 123abcdef\=callout_capture
  678. 123abcdefC-\=callout_none
  679. \= Expect no match
  680. 123abcdef\=callout_fail=1
  681. /(?C0)(abc(?C1))*/I
  682. abcabcabc
  683. abcabc\=callout_fail=1:4
  684. abcabcabc\=callout_fail=1:4
  685. /(\d{3}(?C))*/I
  686. 123\=callout_capture
  687. 123456\=callout_capture
  688. 123456789\=callout_capture
  689. /((xyz)(?C)p|(?C1)xyzabc)/I
  690. xyzabc\=callout_capture
  691. /(X)((xyz)(?C)p|(?C1)xyzabc)/I
  692. Xxyzabc\=callout_capture
  693. /(?=(abc))(?C)abcdef/I
  694. abcdef\=callout_capture
  695. /(?!(abc)(?C1)d)(?C2)abcxyz/I
  696. abcxyz\=callout_capture
  697. /(?<=(abc)(?C))xyz/I
  698. abcxyz\=callout_capture
  699. /a(b+)(c*)(?C1)/I
  700. \= Expect no match
  701. abbbbbccc\=callout_data=1
  702. /a(b+?)(c*?)(?C1)/I
  703. \= Expect no match
  704. abbbbbccc\=callout_data=1
  705. /(?C)abc/I
  706. /(?C)^abc/I
  707. /(?C)a|b/I
  708. /a|(b)(?C)/I
  709. b
  710. /x(ab|(bc|(de|(?R))))/I
  711. xab
  712. xbc
  713. xde
  714. xxab
  715. xxxab
  716. \= Expect no match
  717. xyab
  718. /^([^()]|\((?1)*\))*$/I
  719. abc
  720. a(b)c
  721. a(b(c))d
  722. \= Expect no match)
  723. a(b(c)d
  724. /^>abc>([^()]|\((?1)*\))*<xyz<$/I
  725. >abc>123<xyz<
  726. >abc>1(2)3<xyz<
  727. >abc>(1(2)3)<xyz<
  728. /(a(?1)b)/IB
  729. /(a(?1)+b)/IB
  730. /^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/I
  731. 12
  732. (((2+2)*-3)-7)
  733. -12
  734. \= Expect no match
  735. ((2+2)*-3)-7)
  736. /^(x(y|(?1){2})z)/I
  737. xyz
  738. xxyzxyzz
  739. \= Expect no match
  740. xxyzz
  741. xxyzxyzxyzz
  742. /((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/Ix
  743. <>
  744. <abcd>
  745. <abc <123> hij>
  746. <abc <def> hij>
  747. <abc<>def>
  748. <abc<>
  749. \= Expect no match
  750. <abc
  751. /(?1)/I
  752. /((?2)(abc)/I
  753. /^(abc)def(?1)/I
  754. abcdefabc
  755. /^(a|b|c)=(?1)+/I
  756. a=a
  757. a=b
  758. a=bc
  759. /^(a|b|c)=((?1))+/I
  760. a=a
  761. a=b
  762. a=bc
  763. /a(?P<name1>b|c)d(?P<longername2>e)/IB
  764. abde
  765. acde
  766. /(?:a(?P<c>c(?P<d>d)))(?P<a>a)/IB
  767. /(?P<a>a)...(?P=a)bbb(?P>a)d/IB
  768. /^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/Ii
  769. 1221
  770. Satan, oscillate my metallic sonatas!
  771. A man, a plan, a canal: Panama!
  772. Able was I ere I saw Elba.
  773. \= Expect no match
  774. The quick brown fox
  775. /((?(R)a|b))\1(?1)?/I
  776. bb
  777. bbaa
  778. /(.*)a/Is
  779. /(.*)a\1/Is
  780. /(.*)a(b)\2/Is
  781. /((.*)a|(.*)b)z/Is
  782. /((.*)a|(.*)b)z\1/Is
  783. /((.*)a|(.*)b)z\2/Is
  784. /((.*)a|(.*)b)z\3/Is
  785. /((.*)a|^(.*)b)z\3/Is
  786. /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is
  787. /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is
  788. /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is
  789. /(a)(bc)/IB,no_auto_capture
  790. abc
  791. /(?P<one>a)(bc)/IB,no_auto_capture
  792. abc
  793. /(a)(?P<named>bc)/IB,no_auto_capture
  794. /(aaa(?C1)bbb|ab)/I
  795. aaabbb
  796. aaabbb\=callout_data=0
  797. aaabbb\=callout_data=1
  798. \= Expect no match
  799. aaabbb\=callout_data=-1
  800. /ab(?P<one>cd)ef(?P<two>gh)/I
  801. abcdefgh
  802. abcdefgh\=copy=1,get=two
  803. abcdefgh\=copy=one,copy=two
  804. abcdefgh\=copy=three
  805. /(?P<Tes>)(?P<Test>)/IB
  806. /(?P<Test>)(?P<Tes>)/IB
  807. /(?P<Z>zz)(?P<A>aa)/I
  808. zzaa\=copy=Z
  809. zzaa\=copy=A
  810. /(?P<x>eks)(?P<x>eccs)/I
  811. /(?P<abc>abc(?P<def>def)(?P<abc>xyz))/I
  812. "\[((?P<elem>\d+)(,(?P>elem))*)\]"I
  813. [10,20,30,5,5,4,4,2,43,23,4234]
  814. \= Expect no match
  815. []
  816. "\[((?P<elem>\d+)(,(?P>elem))*)?\]"I
  817. [10,20,30,5,5,4,4,2,43,23,4234]
  818. []
  819. /(a(b(?2)c))?/IB
  820. /(a(b(?2)c))*/IB
  821. /(a(b(?2)c)){0,2}/IB
  822. /[ab]{1}+/B
  823. /()(?1){1}/B
  824. /()(?1)/B
  825. /((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
  826. Baby Bjorn Active Carrier - With free SHIPPING!!
  827. /((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
  828. Baby Bjorn Active Carrier - With free SHIPPING!!
  829. /a*.*b/IB
  830. /(a|b)*.?c/IB
  831. /abc(?C255)de(?C)f/IB
  832. /abcde/IB,auto_callout
  833. abcde
  834. \= Expect no match
  835. abcdfe
  836. /a*b/IB,auto_callout
  837. ab
  838. aaaab
  839. aaaacb
  840. /a*b/IB,auto_callout
  841. ab
  842. aaaab
  843. aaaacb
  844. /a+b/IB,auto_callout
  845. ab
  846. aaaab
  847. \= Expect no match
  848. aaaacb
  849. /(abc|def)x/IB,auto_callout
  850. abcx
  851. defx
  852. \= Expect no match
  853. abcdefzx
  854. /(abc|def)x/IB,auto_callout
  855. abcx
  856. defx
  857. \= Expect no match
  858. abcdefzx
  859. /(ab|cd){3,4}/I,auto_callout
  860. ababab
  861. abcdabcd
  862. abcdcdcdcdcd
  863. /([ab]{,}c|xy)/IB,auto_callout
  864. \= Expect no match
  865. Note: that {,} does NOT introduce a quantifier
  866. /([ab]{,}c|xy)/IB,auto_callout
  867. \= Expect no match
  868. Note: that {,} does NOT introduce a quantifier
  869. /([ab]{1,4}c|xy){4,5}?123/IB,auto_callout
  870. aacaacaacaacaac123
  871. /\b.*/I
  872. ab cd\=offset=1
  873. /\b.*/Is
  874. ab cd\=startoffset=1
  875. /(?!.bcd).*/I
  876. Xbcd12345
  877. /abcde/I
  878. ab\=ps
  879. abc\=ps
  880. abcd\=ps
  881. abcde\=ps
  882. the quick brown abc\=ps
  883. \= Expect no match\=ps
  884. the quick brown abxyz fox\=ps
  885. "^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I
  886. 13/05/04\=ps
  887. 13/5/2004\=ps
  888. 02/05/09\=ps
  889. 1\=ps
  890. 1/2\=ps
  891. 1/2/0\=ps
  892. 1/2/04\=ps
  893. 0\=ps
  894. 02/\=ps
  895. 02/0\=ps
  896. 02/1\=ps
  897. \= Expect no match\=ps
  898. \=ps
  899. 123\=ps
  900. 33/4/04\=ps
  901. 3/13/04\=ps
  902. 0/1/2003\=ps
  903. 0/\=ps
  904. 02/0/\=ps
  905. 02/13\=ps
  906. /0{0,2}ABC/I
  907. /\d{3,}ABC/I
  908. /\d*ABC/I
  909. /[abc]+DE/I
  910. /[abc]?123/I
  911. 123\=ps
  912. a\=ps
  913. b\=ps
  914. c\=ps
  915. c12\=ps
  916. c123\=ps
  917. /^(?:\d){3,5}X/I
  918. 1\=ps
  919. 123\=ps
  920. 123X
  921. 1234\=ps
  922. 1234X
  923. 12345\=ps
  924. 12345X
  925. \= Expect no match
  926. 1X
  927. 123456\=ps
  928. "<(\w+)/?>(.)*</(\1)>"Igms
  929. <!DOCTYPE seite SYSTEM "http://www.lco.lineas.de/xmlCms.dtd">\n<seite>\n<dokumenteninformation>\n<seitentitel>Partner der LCO</seitentitel>\n<sprache>de</sprache>\n<seitenbeschreibung>Partner der LINEAS Consulting\nGmbH</seitenbeschreibung>\n<schluesselworte>LINEAS Consulting GmbH Hamburg\nPartnerfirmen</schluesselworte>\n<revisit>30 days</revisit>\n<robots>index,follow</robots>\n<menueinformation>\n<aktiv>ja</aktiv>\n<menueposition>3</menueposition>\n<menuetext>Partner</menuetext>\n</menueinformation>\n<lastedited>\n<autor>LCO</autor>\n<firma>LINEAS Consulting</firma>\n<datum>15.10.2003</datum>\n</lastedited>\n</dokumenteninformation>\n<inhalt>\n\n<absatzueberschrift>Die Partnerfirmen der LINEAS Consulting\nGmbH</absatzueberschrift>\n\n<absatz><link ziel="http://www.ca.com/" zielfenster="_blank">\n<bild name="logo_ca.gif" rahmen="no"/></link> <link\nziel="http://www.ey.com/" zielfenster="_blank"><bild\nname="logo_euy.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.cisco.de/" zielfenster="_blank">\n<bild name="logo_cisco.gif" rahmen="ja"/></link></absatz>\n\n<absatz><link ziel="http://www.atelion.de/"\nzielfenster="_blank"><bild\nname="logo_atelion.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.line-information.de/"\nzielfenster="_blank">\n<bild name="logo_line_information.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><bild name="logo_aw.gif" rahmen="no"/></absatz>\n\n<absatz><link ziel="http://www.incognis.de/"\nzielfenster="_blank"><bild\nname="logo_incognis.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.addcraft.com/"\nzielfenster="_blank"><bild\nname="logo_addcraft.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.comendo.com/"\nzielfenster="_blank"><bild\nname="logo_comendo.gif" rahmen="no"/></link></absatz>\n\n</inhalt>\n</seite>\=jitstack=1024
  930. /line\nbreak/I
  931. this is a line\nbreak
  932. line one\nthis is a line\nbreak in the second line
  933. /line\nbreak/I,firstline
  934. this is a line\nbreak
  935. \= Expect no match
  936. line one\nthis is a line\nbreak in the second line
  937. /line\nbreak/Im,firstline
  938. this is a line\nbreak
  939. \= Expect no match
  940. line one\nthis is a line\nbreak in the second line
  941. /(?i)(?-i)AbCd/I
  942. AbCd
  943. \= Expect no match
  944. abcd
  945. /a{11111111111111111111}/I
  946. /(){64294967295}/I
  947. /(){2,4294967295}/I
  948. "(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I
  949. abcdefghijklAkB
  950. "(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"I
  951. abcdefghijklAkB
  952. "(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I
  953. abcdefghijklAkB
  954. "(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"I
  955. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  956. "(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"I
  957. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  958. /[^()]*(?:\((?R)\)[^()]*)*/I
  959. (this(and)that
  960. (this(and)that)
  961. (this(and)that)stuff
  962. /[^()]*(?:\((?>(?R))\)[^()]*)*/I
  963. (this(and)that
  964. (this(and)that)
  965. /[^()]*(?:\((?R)\))*[^()]*/I
  966. (this(and)that
  967. (this(and)that)
  968. /(?:\((?R)\))*[^()]*/I
  969. (this(and)that
  970. (this(and)that)
  971. ((this))
  972. /(?:\((?R)\))|[^()]*/I
  973. (this(and)that
  974. (this(and)that)
  975. (this)
  976. ((this))
  977. /\x{0000ff}/I
  978. /^((?P<A>a1)|(?P<A>a2)b)/I
  979. /^((?P<A>a1)|(?P<A>a2)b)/I,dupnames
  980. a1b\=copy=A
  981. a2b\=copy=A
  982. a1b\=copy=Z,copy=A
  983. /(?|(?<a>)(?<b>)(?<a>)|(?<a>)(?<b>)(?<a>))/I,dupnames
  984. /^(?P<A>a)(?P<A>b)/I,dupnames
  985. ab\=copy=A
  986. /^(?P<A>a)(?P<A>b)|cd/I,dupnames
  987. ab\=copy=A
  988. cd\=copy=A
  989. /^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/I,dupnames
  990. cdefgh\=copy=A
  991. /^((?P<A>a1)|(?P<A>a2)b)/I,dupnames
  992. a1b\=get=A
  993. a2b\=get=A
  994. a1b\=get=Z,get=A
  995. /^(?P<A>a)(?P<A>b)/I,dupnames
  996. ab\=get=A
  997. /^(?P<A>a)(?P<A>b)|cd/I,dupnames
  998. ab\=get=A
  999. cd\=get=A
  1000. /^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/I,dupnames
  1001. cdefgh\=get=A
  1002. /(?J)^((?P<A>a1)|(?P<A>a2)b)/I
  1003. a1b\=copy=A
  1004. a2b\=copy=A
  1005. /^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/I
  1006. # In this next test, J is not set at the outer level; consequently it isn't set
  1007. # in the pattern's options; consequently pcre2_substring_get_byname() produces
  1008. # a random value.
  1009. /^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/I
  1010. a bc d\=copy=A,copy=B,copy=C
  1011. /^(?P<A>a)?(?(A)a|b)/I
  1012. aabc
  1013. bc
  1014. \= Expect no match
  1015. abc
  1016. /(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
  1017. bXaX
  1018. /(?:(?(2y)a|b)(X))+/I
  1019. /(?:(?(ZA)a|b)(?P<ZZ>X))+/I
  1020. /(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
  1021. bbXaaX
  1022. /(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
  1023. (b)\\Xa\\X
  1024. /(?P<ABC/I
  1025. /(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
  1026. bXXaYYaY
  1027. bXYaXXaX
  1028. /()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
  1029. bXXaYYaY
  1030. /\s*,\s*/I
  1031. \x0b,\x0b
  1032. \x0c,\x0d
  1033. /^abc/Im,newline=lf
  1034. xyz\nabc
  1035. xyz\r\nabc
  1036. \= Expect no match
  1037. xyz\rabc
  1038. xyzabc\r
  1039. xyzabc\rpqr
  1040. xyzabc\r\n
  1041. xyzabc\r\npqr
  1042. /^abc/Im,newline=crlf
  1043. xyz\r\nabclf>
  1044. \= Expect no match
  1045. xyz\nabclf
  1046. xyz\rabclf
  1047. /^abc/Im,newline=cr
  1048. xyz\rabc
  1049. \= Expect no match
  1050. xyz\nabc
  1051. xyz\r\nabc
  1052. /^abc/Im,newline=bad
  1053. /.*/I,newline=lf
  1054. abc\ndef
  1055. abc\rdef
  1056. abc\r\ndef
  1057. /.*/I,newline=cr
  1058. abc\ndef
  1059. abc\rdef
  1060. abc\r\ndef
  1061. /.*/I,newline=crlf
  1062. abc\ndef
  1063. abc\rdef
  1064. abc\r\ndef
  1065. /\w+(.)(.)?def/Is
  1066. abc\ndef
  1067. abc\rdef
  1068. abc\r\ndef
  1069. /(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
  1070. /()()()()()()()()()()()()()()()()()()()()
  1071. ()()()()()()()()()()()()()()()()()()()()
  1072. ()()()()()()()()()()()()()()()()()()()()
  1073. ()()()()()()()()()()()()()()()()()()()()
  1074. ()()()()()()()()()()()()()()()()()()()()
  1075. (.(.))/Ix
  1076. XY\=ovector=133
  1077. /(a*b|(?i:c*(?-i)d))/I
  1078. /()[ab]xyz/I
  1079. /(|)[ab]xyz/I
  1080. /(|c)[ab]xyz/I
  1081. /(|c?)[ab]xyz/I
  1082. /(d?|c?)[ab]xyz/I
  1083. /(d?|c)[ab]xyz/I
  1084. /^a*b\d/IB
  1085. /^a*+b\d/IB
  1086. /^a*?b\d/IB
  1087. /^a+A\d/IB
  1088. aaaA5
  1089. \= Expect no match
  1090. aaaa5
  1091. /^a*A\d/IBi
  1092. aaaA5
  1093. aaaa5
  1094. a5
  1095. /(a*|b*)[cd]/I
  1096. /(a+|b*)[cd]/I
  1097. /(a*|b+)[cd]/I
  1098. /(a+|b+)[cd]/I
  1099. /((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
  1100. ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
  1101. (((
  1102. a
  1103. ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
  1104. ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
  1105. )))
  1106. /Ix
  1107. large nest
  1108. /a*\d/B
  1109. /a*\D/B
  1110. /0*\d/B
  1111. /0*\D/B
  1112. /a*\s/B
  1113. /a*\S/B
  1114. / *\s/B
  1115. / *\S/B
  1116. /a*\w/B
  1117. /a*\W/B
  1118. /=*\w/B
  1119. /=*\W/B
  1120. /\d*a/B
  1121. /\d*2/B
  1122. /\d*\d/B
  1123. /\d*\D/B
  1124. /\d*\s/B
  1125. /\d*\S/B
  1126. /\d*\w/B
  1127. /\d*\W/B
  1128. /\D*a/B
  1129. /\D*2/B
  1130. /\D*\d/B
  1131. /\D*\D/B
  1132. /\D*\s/B
  1133. /\D*\S/B
  1134. /\D*\w/B
  1135. /\D*\W/B
  1136. /\s*a/B
  1137. /\s*2/B
  1138. /\s*\d/B
  1139. /\s*\D/B
  1140. /\s*\s/B
  1141. /\s*\S/B
  1142. /\s*\w/B
  1143. /\s*\W/B
  1144. /\S*a/B
  1145. /\S*2/B
  1146. /\S*\d/B
  1147. /\S*\D/B
  1148. /\S*\s/B
  1149. /\S*\S/B
  1150. /\S*\w/B
  1151. /\S*\W/B
  1152. /\w*a/B
  1153. /\w*2/B
  1154. /\w*\d/B
  1155. /\w*\D/B
  1156. /\w*\s/B
  1157. /\w*\S/B
  1158. /\w*\w/B
  1159. /\w*\W/B
  1160. /\W*a/B
  1161. /\W*2/B
  1162. /\W*\d/B
  1163. /\W*\D/B
  1164. /\W*\s/B
  1165. /\W*\S/B
  1166. /\W*\w/B
  1167. /\W*\W/B
  1168. /[^a]+a/B
  1169. /[^a]+a/Bi
  1170. /[^a]+A/Bi
  1171. /[^a]+b/B
  1172. /[^a]+\d/B
  1173. /a*[^a]/B
  1174. /(?P<abc>x)(?P<xyz>y)/I
  1175. xy\=copy=abc,copy=xyz
  1176. /(?<abc>x)(?'xyz'y)/I
  1177. xy\=copy=abc,copy=xyz
  1178. /(?<abc'x)(?'xyz'y)/I
  1179. /(?<abc>x)(?'xyz>y)/I
  1180. /(?P'abc'x)(?P<xyz>y)/I
  1181. /^(?:(?(ZZ)a|b)(?<ZZ>X))+/
  1182. bXaX
  1183. bXbX
  1184. \= Expect no match
  1185. aXaX
  1186. aXbX
  1187. /^(?P>abc)(?<abcd>xxx)/
  1188. /^(?P>abc)(?<abc>x|y)/
  1189. xx
  1190. xy
  1191. yy
  1192. yx
  1193. /^(?P>abc)(?P<abc>x|y)/
  1194. xx
  1195. xy
  1196. yy
  1197. yx
  1198. /^((?(abc)a|b)(?<abc>x|y))+/
  1199. bxay
  1200. bxby
  1201. \= Expect no match
  1202. axby
  1203. /^(((?P=abc)|X)(?<abc>x|y))+/
  1204. XxXxxx
  1205. XxXyyx
  1206. XxXyxx
  1207. \= Expect no match
  1208. x
  1209. /^(?1)(abc)/
  1210. abcabc
  1211. /^(?:(?:\1|X)(a|b))+/
  1212. Xaaa
  1213. Xaba
  1214. /^[\E\Qa\E-\Qz\E]+/B
  1215. /^[a\Q]bc\E]/B
  1216. /^[a-\Q\E]/B
  1217. /^(?P>abc)[()](?<abc>)/B
  1218. /^((?(abc)y)[()](?P<abc>x))+/B
  1219. (xy)x
  1220. /^(?P>abc)\Q()\E(?<abc>)/B
  1221. /^(?P>abc)[a\Q(]\E(](?<abc>)/B
  1222. /^(?P>abc) # this is (a comment)
  1223. (?<abc>)/Bx
  1224. /^\W*(?:(?<one>(?<two>.)\W*(?&one)\W*\k<two>|)|(?<three>(?<four>.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii
  1225. 1221
  1226. Satan, oscillate my metallic sonatas!
  1227. A man, a plan, a canal: Panama!
  1228. Able was I ere I saw Elba.
  1229. \= Expect no match
  1230. The quick brown fox
  1231. /(?=(\w+))\1:/I
  1232. abcd:
  1233. /(?=(?'abc'\w+))\k<abc>:/I
  1234. abcd:
  1235. /(?'abc'a|b)(?<abc>d|e)\k<abc>{2}/dupnames
  1236. adaa
  1237. \= Expect no match
  1238. addd
  1239. adbb
  1240. /(?'abc'a|b)(?<abc>d|e)(?&abc){2}/dupnames
  1241. bdaa
  1242. bdab
  1243. \= Expect no match
  1244. bddd
  1245. /(?(<bc))/
  1246. /(?(''))/
  1247. /(?('R')stuff)/
  1248. /((abc (?(R) (?(R1)1) (?(R2)2) X | (?1) (?2) (?R) ))) /x
  1249. abcabc1Xabc2XabcXabcabc
  1250. /(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
  1251. abcabc1Xabc2XabcXabcabc
  1252. /(?<A> (?'B' abc (?(R) (?(R&C)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
  1253. /^(?(DEFINE) abc | xyz ) /x
  1254. /(?(DEFINE) abc) xyz/Ix
  1255. /(a|)*\d/
  1256. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4\=ovector=0
  1257. \= Expect no match
  1258. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=0
  1259. /^a.b/newline=lf
  1260. a\rb
  1261. \= Expect no match
  1262. a\nb
  1263. /^a.b/newline=cr
  1264. a\nb
  1265. \= Expect no match
  1266. a\rb
  1267. /^a.b/newline=anycrlf
  1268. a\x85b
  1269. \= Expect no match
  1270. a\rb
  1271. /^a.b/newline=any
  1272. \= Expect no match
  1273. a\nb
  1274. a\rb
  1275. a\x85b
  1276. /^abc./gmx,newline=any
  1277. abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
  1278. /abc.$/gmx,newline=any
  1279. abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7 abc9
  1280. /^a\Rb/bsr=unicode
  1281. a\nb
  1282. a\rb
  1283. a\r\nb
  1284. a\x0bb
  1285. a\x0cb
  1286. a\x85b
  1287. \= Expect no match
  1288. a\n\rb
  1289. /^a\R*b/bsr=unicode
  1290. ab
  1291. a\nb
  1292. a\rb
  1293. a\r\nb
  1294. a\x0bb
  1295. a\x0cb
  1296. a\x85b
  1297. a\n\rb
  1298. a\n\r\x85\x0cb
  1299. /^a\R+b/bsr=unicode
  1300. a\nb
  1301. a\rb
  1302. a\r\nb
  1303. a\x0bb
  1304. a\x0cb
  1305. a\x85b
  1306. a\n\rb
  1307. a\n\r\x85\x0cb
  1308. \= Expect no match
  1309. ab
  1310. /^a\R{1,3}b/bsr=unicode
  1311. a\nb
  1312. a\n\rb
  1313. a\n\r\x85b
  1314. a\r\n\r\nb
  1315. a\r\n\r\n\r\nb
  1316. a\n\r\n\rb
  1317. a\n\n\r\nb
  1318. \= Expect no match
  1319. a\n\n\n\rb
  1320. a\r
  1321. /(?&abc)X(?<abc>P)/I
  1322. abcPXP123
  1323. /(?1)X(?<abc>P)/I
  1324. abcPXP123
  1325. /(?:a(?&abc)b)*(?<abc>x)/
  1326. 123axbaxbaxbx456
  1327. 123axbaxbaxb456
  1328. /(?:a(?&abc)b){1,5}(?<abc>x)/
  1329. 123axbaxbaxbx456
  1330. /(?:a(?&abc)b){2,5}(?<abc>x)/
  1331. 123axbaxbaxbx456
  1332. /(?:a(?&abc)b){2,}(?<abc>x)/
  1333. 123axbaxbaxbx456
  1334. /(abc)(?i:(?1))/
  1335. defabcabcxyz
  1336. \= Expect no match
  1337. DEFabcABCXYZ
  1338. /(abc)(?:(?i)(?1))/
  1339. defabcabcxyz
  1340. \= Expect no match
  1341. DEFabcABCXYZ
  1342. /^(a)\g-2/
  1343. /^(a)\g/
  1344. /^(a)\g{0}/
  1345. /^(a)\g{3/
  1346. /^(a)\g{aa}/
  1347. /^a.b/newline=lf
  1348. a\rb
  1349. \= Expect no match
  1350. a\nb
  1351. /.+foo/
  1352. afoo
  1353. \= Expect no match
  1354. \r\nfoo
  1355. \nfoo
  1356. /.+foo/newline=crlf
  1357. afoo
  1358. \nfoo
  1359. \= Expect no match
  1360. \r\nfoo
  1361. /.+foo/newline=any
  1362. afoo
  1363. \= Expect no match
  1364. \nfoo
  1365. \r\nfoo
  1366. /.+foo/s
  1367. afoo
  1368. \r\nfoo
  1369. \nfoo
  1370. /^$/gm,newline=any
  1371. abc\r\rxyz
  1372. abc\n\rxyz
  1373. \= Expect no match
  1374. abc\r\nxyz
  1375. /(?m)^$/g,newline=any,aftertext
  1376. abc\r\n\r\n
  1377. /(?m)^$|^\r\n/g,newline=any,aftertext
  1378. abc\r\n\r\n
  1379. /(?m)$/g,newline=any,aftertext
  1380. abc\r\n\r\n
  1381. /abc.$/gmx,newline=anycrlf
  1382. abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
  1383. /^X/m
  1384. XABC
  1385. \= Expect no match
  1386. XABC\=notbol
  1387. /(ab|c)(?-1)/B
  1388. abc
  1389. /xy(?+1)(abc)/B
  1390. xyabcabc
  1391. \= Expect no match
  1392. xyabc
  1393. /x(?-0)y/
  1394. /x(?-1)y/
  1395. /x(?+0)y/
  1396. /x(?+1)y/
  1397. /^(abc)?(?(-1)X|Y)/B
  1398. abcX
  1399. Y
  1400. \= Expect no match
  1401. abcY
  1402. /^((?(+1)X|Y)(abc))+/B
  1403. YabcXabc
  1404. YabcXabcXabc
  1405. \= Expect no match
  1406. XabcXabc
  1407. /(?(-1)a)/B
  1408. /((?(-1)a))/B
  1409. /((?(-2)a))/B
  1410. /^(?(+1)X|Y)(.)/B
  1411. Y!
  1412. /(?<A>tom|bon)-\k{A}/
  1413. tom-tom
  1414. bon-bon
  1415. \= Expect no match
  1416. tom-bon
  1417. /\g{A/
  1418. /(?|(abc)|(xyz))/B
  1419. >abc<
  1420. >xyz<
  1421. /(x)(?|(abc)|(xyz))(x)/B
  1422. xabcx
  1423. xxyzx
  1424. /(x)(?|(abc)(pqr)|(xyz))(x)/B
  1425. xabcpqrx
  1426. xxyzx
  1427. /\H++X/B
  1428. \= Expect no match
  1429. XXXX
  1430. /\H+\hY/B
  1431. XXXX Y
  1432. /\H+ Y/B
  1433. /\h+A/B
  1434. /\v*B/B
  1435. /\V+\x0a/B
  1436. /A+\h/B
  1437. / *\H/B
  1438. /A*\v/B
  1439. /\x0b*\V/B
  1440. /\d+\h/B
  1441. /\d*\v/B
  1442. /S+\h\S+\v/B
  1443. /\w{3,}\h\w+\v/B
  1444. /\h+\d\h+\w\h+\S\h+\H/B
  1445. /\v+\d\v+\w\v+\S\v+\V/B
  1446. /\H+\h\H+\d/B
  1447. /\V+\v\V+\w/B
  1448. /\( (?: [^()]* | (?R) )* \)/x
  1449. (0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(00)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)\=jitstack=1024
  1450. /[\E]AAA/
  1451. /[\Q\E]AAA/
  1452. /[^\E]AAA/
  1453. /[^\Q\E]AAA/
  1454. /[\E^]AAA/
  1455. /[\Q\E^]AAA/
  1456. /A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/B
  1457. /^a+(*FAIL)/auto_callout
  1458. \= Expect no match
  1459. aaaaaa
  1460. /a+b?c+(*FAIL)/auto_callout
  1461. \= Expect no match
  1462. aaabccc
  1463. /a+b?(*PRUNE)c+(*FAIL)/auto_callout
  1464. \= Expect no match
  1465. aaabccc
  1466. /a+b?(*COMMIT)c+(*FAIL)/auto_callout
  1467. \= Expect no match
  1468. aaabccc
  1469. /a+b?(*SKIP)c+(*FAIL)/auto_callout
  1470. \= Expect no match
  1471. aaabcccaaabccc
  1472. /a+b?(*THEN)c+(*FAIL)/auto_callout
  1473. \= Expect no match
  1474. aaabccc
  1475. /a(*MARK)b/
  1476. /\g6666666666/
  1477. /[\g6666666666]/B
  1478. /(?1)\c[/
  1479. /.+A/newline=crlf
  1480. \= Expect no match
  1481. \r\nA
  1482. /\nA/newline=crlf
  1483. \r\nA
  1484. /[\r\n]A/newline=crlf
  1485. \r\nA
  1486. /(\r|\n)A/newline=crlf
  1487. \r\nA
  1488. /a(*CR)b/
  1489. /(*CR)a.b/
  1490. a\nb
  1491. \= Expect no match
  1492. a\rb
  1493. /(*CR)a.b/newline=lf
  1494. a\nb
  1495. \= Expect no match
  1496. a\rb
  1497. /(*LF)a.b/newline=CRLF
  1498. a\rb
  1499. \= Expect no match
  1500. a\nb
  1501. /(*CRLF)a.b/
  1502. a\rb
  1503. a\nb
  1504. \= Expect no match
  1505. a\r\nb
  1506. /(*ANYCRLF)a.b/newline=CR
  1507. \= Expect no match
  1508. a\rb
  1509. a\nb
  1510. a\r\nb
  1511. /(*ANY)a.b/newline=cr
  1512. \= Expect no match
  1513. a\rb
  1514. a\nb
  1515. a\r\nb
  1516. a\x85b
  1517. /(*ANY).*/g
  1518. abc\r\ndef
  1519. /(*ANYCRLF).*/g
  1520. abc\r\ndef
  1521. /(*CRLF).*/g
  1522. abc\r\ndef
  1523. /(*NUL)^.*/
  1524. a\nb\x00ccc
  1525. /(*NUL)^.*/s
  1526. a\nb\x00ccc
  1527. /^x/m,newline=NUL
  1528. ab\x00xy
  1529. /'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex
  1530. x\nyz
  1531. /(*NUL)^X\NY/
  1532. X\nY
  1533. X\rY
  1534. \= Expect no match
  1535. X\x00Y
  1536. /a\Rb/I,bsr=anycrlf
  1537. a\rb
  1538. a\nb
  1539. a\r\nb
  1540. \= Expect no match
  1541. a\x85b
  1542. a\x0bb
  1543. /a\Rb/I,bsr=unicode
  1544. a\rb
  1545. a\nb
  1546. a\r\nb
  1547. a\x85b
  1548. a\x0bb
  1549. /a\R?b/I,bsr=anycrlf
  1550. a\rb
  1551. a\nb
  1552. a\r\nb
  1553. \= Expect no match
  1554. a\x85b
  1555. a\x0bb
  1556. /a\R?b/I,bsr=unicode
  1557. a\rb
  1558. a\nb
  1559. a\r\nb
  1560. a\x85b
  1561. a\x0bb
  1562. /a\R{2,4}b/I,bsr=anycrlf
  1563. a\r\n\nb
  1564. a\n\r\rb
  1565. a\r\n\r\n\r\n\r\nb
  1566. \= Expect no match
  1567. a\x85\x85b
  1568. a\x0b\x0bb
  1569. /a\R{2,4}b/I,bsr=unicode
  1570. a\r\rb
  1571. a\n\n\nb
  1572. a\r\n\n\r\rb
  1573. a\x85\x85b
  1574. a\x0b\x0bb
  1575. \= Expect no match
  1576. a\r\r\r\r\rb
  1577. /(*BSR_ANYCRLF)a\Rb/I
  1578. a\nb
  1579. a\rb
  1580. /(*BSR_UNICODE)a\Rb/I
  1581. a\x85b
  1582. /(*BSR_ANYCRLF)(*CRLF)a\Rb/I
  1583. a\nb
  1584. a\rb
  1585. /(*CRLF)(*BSR_UNICODE)a\Rb/I
  1586. a\x85b
  1587. /(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
  1588. /(?<a>)(?&)/
  1589. /(?<abc>)(?&a)/
  1590. /(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
  1591. /(?+-a)/
  1592. /(?-+a)/
  1593. /(?(-1))/
  1594. /(?(+10))/
  1595. /(?(10))/
  1596. /(?(+2))()()/
  1597. /(?(2))()()/
  1598. /\k''/
  1599. /\k<>/
  1600. /\k{}/
  1601. /\k/
  1602. /\kabc/
  1603. /(?P=)/
  1604. /(?P>)/
  1605. /[[:foo:]]/
  1606. /[[:1234:]]/
  1607. /[[:f\oo:]]/
  1608. /[[: :]]/
  1609. /[[:...:]]/
  1610. /[[:l\ower:]]/
  1611. /[[:abc\:]]/
  1612. /[abc[:x\]pqr:]]/
  1613. /[[:a\dz:]]/
  1614. /(^(a|b\g<-1'c))/
  1615. /^(?+1)(?<a>x|y){0}z/
  1616. xzxx
  1617. yzyy
  1618. \= Expect no match
  1619. xxz
  1620. /(\3)(\1)(a)/
  1621. \= Expect no match
  1622. cat
  1623. /(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
  1624. cat
  1625. /TA]/
  1626. The ACTA] comes
  1627. /TA]/allow_empty_class,match_unset_backref,dupnames
  1628. The ACTA] comes
  1629. /(?2)[]a()b](abc)/
  1630. abcbabc
  1631. /(?2)[^]a()b](abc)/
  1632. abcbabc
  1633. /(?1)[]a()b](abc)/
  1634. abcbabc
  1635. \= Expect no match
  1636. abcXabc
  1637. /(?1)[^]a()b](abc)/
  1638. abcXabc
  1639. \= Expect no match
  1640. abcbabc
  1641. /(?2)[]a()b](abc)(xyz)/
  1642. xyzbabcxyz
  1643. /(?&N)[]a(?<N>)](?<M>abc)/
  1644. abc<abc
  1645. /(?&N)[]a(?<N>)](abc)/
  1646. abc<abc
  1647. /a[]b/
  1648. /a[^]b/
  1649. /a[]b/allow_empty_class,match_unset_backref,dupnames
  1650. \= Expect no match
  1651. ab
  1652. /a[]+b/allow_empty_class,match_unset_backref,dupnames
  1653. \= Expect no match
  1654. ab
  1655. /a[]*+b/allow_empty_class,match_unset_backref,dupnames
  1656. \= Expect no match
  1657. ab
  1658. /a[^]b/allow_empty_class,match_unset_backref,dupnames
  1659. aXb
  1660. a\nb
  1661. \= Expect no match
  1662. ab
  1663. /a[^]+b/allow_empty_class,match_unset_backref,dupnames
  1664. aXb
  1665. a\nX\nXb
  1666. \= Expect no match
  1667. ab
  1668. /a(?!)b/B
  1669. /(?!)?a/B
  1670. ab
  1671. /a(*FAIL)+b/
  1672. /(abc|pqr|123){0}[xyz]/I
  1673. /(?(?=.*b)b|^)/I,auto_callout
  1674. adc
  1675. abc
  1676. /(?(?=b).*b|^d)/I
  1677. /(?(?=.*b).*b|^d)/I
  1678. /xyz/auto_callout
  1679. xyz
  1680. abcxyz
  1681. \= Expect no match
  1682. abc
  1683. abcxypqr
  1684. /xyz/auto_callout,no_start_optimize
  1685. abcxyz
  1686. \= Expect no match
  1687. abc
  1688. abcxypqr
  1689. /(*NO_START_OPT)xyz/auto_callout
  1690. abcxyz
  1691. /(*NO_AUTO_POSSESS)a+b/B
  1692. /xyz/auto_callout,no_start_optimize
  1693. abcxyz
  1694. /^"((?(?=[a])[^"])|b)*"$/auto_callout
  1695. "ab"
  1696. /^"((?(?=[a])[^"])|b)*"$/
  1697. "ab"
  1698. /^X(?5)(a)(?|(b)|(q))(c)(d)Y/
  1699. XYabcdY
  1700. /^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)/
  1701. XYabcdY
  1702. /Xa{2,4}b/
  1703. X\=ps
  1704. Xa\=ps
  1705. Xaa\=ps
  1706. Xaaa\=ps
  1707. Xaaaa\=ps
  1708. /Xa{2,4}?b/
  1709. X\=ps
  1710. Xa\=ps
  1711. Xaa\=ps
  1712. Xaaa\=ps
  1713. Xaaaa\=ps
  1714. /Xa{2,4}+b/
  1715. X\=ps
  1716. Xa\=ps
  1717. Xaa\=ps
  1718. Xaaa\=ps
  1719. Xaaaa\=ps
  1720. /X\d{2,4}b/
  1721. X\=ps
  1722. X3\=ps
  1723. X33\=ps
  1724. X333\=ps
  1725. X3333\=ps
  1726. /X\d{2,4}?b/
  1727. X\=ps
  1728. X3\=ps
  1729. X33\=ps
  1730. X333\=ps
  1731. X3333\=ps
  1732. /X\d{2,4}+b/
  1733. X\=ps
  1734. X3\=ps
  1735. X33\=ps
  1736. X333\=ps
  1737. X3333\=ps
  1738. /X\D{2,4}b/
  1739. X\=ps
  1740. Xa\=ps
  1741. Xaa\=ps
  1742. Xaaa\=ps
  1743. Xaaaa\=ps
  1744. /X\D{2,4}?b/
  1745. X\=ps
  1746. Xa\=ps
  1747. Xaa\=ps
  1748. Xaaa\=ps
  1749. Xaaaa\=ps
  1750. /X\D{2,4}+b/
  1751. X\=ps
  1752. Xa\=ps
  1753. Xaa\=ps
  1754. Xaaa\=ps
  1755. Xaaaa\=ps
  1756. /X[abc]{2,4}b/
  1757. X\=ps
  1758. Xa\=ps
  1759. Xaa\=ps
  1760. Xaaa\=ps
  1761. Xaaaa\=ps
  1762. /X[abc]{2,4}?b/
  1763. X\=ps
  1764. Xa\=ps
  1765. Xaa\=ps
  1766. Xaaa\=ps
  1767. Xaaaa\=ps
  1768. /X[abc]{2,4}+b/
  1769. X\=ps
  1770. Xa\=ps
  1771. Xaa\=ps
  1772. Xaaa\=ps
  1773. Xaaaa\=ps
  1774. /X[^a]{2,4}b/
  1775. X\=ps
  1776. Xz\=ps
  1777. Xzz\=ps
  1778. Xzzz\=ps
  1779. Xzzzz\=ps
  1780. /X[^a]{2,4}?b/
  1781. X\=ps
  1782. Xz\=ps
  1783. Xzz\=ps
  1784. Xzzz\=ps
  1785. Xzzzz\=ps
  1786. /X[^a]{2,4}+b/
  1787. X\=ps
  1788. Xz\=ps
  1789. Xzz\=ps
  1790. Xzzz\=ps
  1791. Xzzzz\=ps
  1792. /(Y)X\1{2,4}b/
  1793. YX\=ps
  1794. YXY\=ps
  1795. YXYY\=ps
  1796. YXYYY\=ps
  1797. YXYYYY\=ps
  1798. /(Y)X\1{2,4}?b/
  1799. YX\=ps
  1800. YXY\=ps
  1801. YXYY\=ps
  1802. YXYYY\=ps
  1803. YXYYYY\=ps
  1804. /(Y)X\1{2,4}+b/
  1805. YX\=ps
  1806. YXY\=ps
  1807. YXYY\=ps
  1808. YXYYY\=ps
  1809. YXYYYY\=ps
  1810. /\++\KZ|\d+X|9+Y/startchar
  1811. ++++123999\=ps
  1812. ++++123999Y\=ps
  1813. ++++Z1234\=ps
  1814. /Z(*F)/
  1815. \= Expect no match
  1816. Z\=ps
  1817. ZA\=ps
  1818. /Z(?!)/
  1819. \= Expect no match
  1820. Z\=ps
  1821. ZA\=ps
  1822. /dog(sbody)?/
  1823. dogs\=ps
  1824. dogs\=ph
  1825. /dog(sbody)??/
  1826. dogs\=ps
  1827. dogs\=ph
  1828. /dog|dogsbody/
  1829. dogs\=ps
  1830. dogs\=ph
  1831. /dogsbody|dog/
  1832. dogs\=ps
  1833. dogs\=ph
  1834. /\bthe cat\b/
  1835. the cat\=ps
  1836. the cat\=ph
  1837. /abc/
  1838. abc\=ps
  1839. abc\=ph
  1840. /abc\K123/startchar
  1841. xyzabc123pqr
  1842. xyzabc12\=ps
  1843. xyzabc12\=ph
  1844. /(?<=abc)123/
  1845. xyzabc123pqr
  1846. xyzabc12\=ps
  1847. xyzabc12\=ph
  1848. /\babc\b/
  1849. +++abc+++
  1850. +++ab\=ps
  1851. +++ab\=ph
  1852. /(?&word)(?&element)(?(DEFINE)(?<element><[^m][^>]>[^<])(?<word>\w*+))/B
  1853. /(?&word)(?&element)(?(DEFINE)(?<element><[^\d][^>]>[^<])(?<word>\w*+))/B
  1854. /(ab)(x(y)z(cd(*ACCEPT)))pq/B
  1855. /abc\K/aftertext,startchar
  1856. abcdef
  1857. abcdef\=notempty_atstart
  1858. xyzabcdef\=notempty_atstart
  1859. \= Expect no match
  1860. abcdef\=notempty
  1861. xyzabcdef\=notempty
  1862. /^(?:(?=abc)|abc\K)/aftertext,startchar
  1863. abcdef
  1864. abcdef\=notempty_atstart
  1865. \= Expect no match
  1866. abcdef\=notempty
  1867. /a?b?/aftertext
  1868. xyz
  1869. xyzabc
  1870. xyzabc\=notempty
  1871. xyzabc\=notempty_atstart
  1872. xyz\=notempty_atstart
  1873. \= Expect no match
  1874. xyz\=notempty
  1875. /^a?b?/aftertext
  1876. xyz
  1877. xyzabc
  1878. \= Expect no match
  1879. xyzabc\=notempty
  1880. xyzabc\=notempty_atstart
  1881. xyz\=notempty_atstart
  1882. xyz\=notempty
  1883. /^(?<name>a|b\g<name>c)/
  1884. aaaa
  1885. bacxxx
  1886. bbaccxxx
  1887. bbbacccxx
  1888. /^(?<name>a|b\g'name'c)/
  1889. aaaa
  1890. bacxxx
  1891. bbaccxxx
  1892. bbbacccxx
  1893. /^(a|b\g<1>c)/
  1894. aaaa
  1895. bacxxx
  1896. bbaccxxx
  1897. bbbacccxx
  1898. /^(a|b\g'1'c)/
  1899. aaaa
  1900. bacxxx
  1901. bbaccxxx
  1902. bbbacccxx
  1903. /^(a|b\g'-1'c)/
  1904. aaaa
  1905. bacxxx
  1906. bbaccxxx
  1907. bbbacccxx
  1908. /(^(a|b\g<-1>c))/
  1909. aaaa
  1910. bacxxx
  1911. bbaccxxx
  1912. bbbacccxx
  1913. /(?-i:\g<name>)(?i:(?<name>a))/
  1914. XaaX
  1915. XAAX
  1916. /(?i:\g<name>)(?-i:(?<name>a))/
  1917. XaaX
  1918. \= Expect no match
  1919. XAAX
  1920. /(?-i:\g<+1>)(?i:(a))/
  1921. XaaX
  1922. XAAX
  1923. /(?=(?<regex>(?#simplesyntax)\$(?<name>[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)(?:\[(?<index>[a-zA-Z0-9_\x{7f}-\x{ff}]+|\$\g<name>)\]|->\g<name>(\(.*?\))?)?|(?#simple syntax withbraces)\$\{(?:\g<name>(?<indices>\[(?:\g<index>|'(?:\\.|[^'\\])*'|"(?:\g<regex>|\\.|[^"\\])*")\])?|\g<complex>|\$\{\g<complex>\})\}|(?#complexsyntax)\{(?<complex>\$(?<segment>\g<name>(\g<indices>*|\(.*?\))?)(?:->\g<segment>)*|\$\g<complex>|\$\{\g<complex>\})\}))\{/
  1924. /(?<n>a|b|c)\g<n>*/
  1925. abc
  1926. accccbbb
  1927. /^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)/
  1928. XYabcdY
  1929. /(?<=b(?1)|zzz)(a)/
  1930. xbaax
  1931. xzzzax
  1932. /(a)(?<=b\1)/
  1933. /(a)(?<=b+(?1))/
  1934. /(a+)(?<=b(?1))/
  1935. /(a(?<=b(?1)))/
  1936. /(?<=b(?1))xyz/
  1937. /(?<=b(?1))xyz(b+)pqrstuvew/
  1938. /(a|bc)\1/I
  1939. /(a|bc)\1{2,3}/I
  1940. /(a|bc)(?1)/I
  1941. /(a|b\1)(a|b\1)/I
  1942. /(a|b\1){2}/I
  1943. /(a|bbbb\1)(a|bbbb\1)/I
  1944. /(a|bbbb\1){2}/I
  1945. /^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]/I
  1946. /<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>/Iis
  1947. "(?>.*/)foo"I
  1948. /(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /Ix
  1949. /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/Ii
  1950. /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/I
  1951. /<a[\s]+href[\s]*=[\s]* # find <a href=
  1952. ([\"\'])? # find single or double quote
  1953. (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching
  1954. # quote, otherwise match up to next space
  1955. /Iisx
  1956. /^(?!:) # colon disallowed at start
  1957. (?: # start of item
  1958. (?: [0-9a-f]{1,4} | # 1-4 hex digits or
  1959. (?(1)0 | () ) ) # if null previously matched, fail; else null
  1960. : # followed by colon
  1961. ){1,7} # end item; 1-7 of them required
  1962. [0-9a-f]{1,4} $ # final hex number at end of string
  1963. (?(1)|.) # check that there was an empty component
  1964. /Iix
  1965. /(?|(?<a>A)|(?<a>B))/I
  1966. AB\=copy=a
  1967. BA\=copy=a
  1968. /(?|(?<a>A)|(?<b>B))/
  1969. /(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |
  1970. b(?<quote> (?<apostrophe>')|(?<realquote>")) )
  1971. (?('quote')[a-z]+|[0-9]+)/Ix,dupnames
  1972. a"aaaaa
  1973. b"aaaaa
  1974. \= Expect no match
  1975. b"11111
  1976. a"11111
  1977. /^(?|(a)(b)(c)(?<D>d)|(?<D>e)) (?('D')X|Y)/IBx,dupnames
  1978. abcdX
  1979. eX
  1980. \= Expect no match
  1981. abcdY
  1982. ey
  1983. /(?<A>a) (b)(c) (?<A>d (?(R&A)$ | (?4)) )/IBx,dupnames
  1984. abcdd
  1985. \= Expect no match
  1986. abcdde
  1987. /abcd*/
  1988. xxxxabcd\=ps
  1989. xxxxabcd\=ph
  1990. /abcd*/i
  1991. xxxxabcd\=ps
  1992. xxxxabcd\=ph
  1993. XXXXABCD\=ps
  1994. XXXXABCD\=ph
  1995. /abc\d*/
  1996. xxxxabc1\=ps
  1997. xxxxabc1\=ph
  1998. /(a)bc\1*/
  1999. xxxxabca\=ps
  2000. xxxxabca\=ph
  2001. /abc[de]*/
  2002. xxxxabcde\=ps
  2003. xxxxabcde\=ph
  2004. /(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
  2005. cat
  2006. /(\3)(\1)(a)/I,allow_empty_class,match_unset_backref,dupnames
  2007. cat
  2008. /(\3)(\1)(a)/I
  2009. \= Expect no match
  2010. cat
  2011. /i(?(DEFINE)(?<s>a))/I
  2012. i
  2013. /()i(?(1)a)/I
  2014. ia
  2015. /(?i)a(?-i)b|c/B
  2016. XabX
  2017. XAbX
  2018. CcC
  2019. \= Expect no match
  2020. XABX
  2021. /(?i)a(?s)b|c/B
  2022. /(?i)a(?s-i)b|c/B
  2023. /^(ab(c\1)d|x){2}$/B
  2024. xabcxd
  2025. /^(?&t)*+(?(DEFINE)(?<t>.))$/B
  2026. /^(?&t)*(?(DEFINE)(?<t>.))$/B
  2027. # This one is here because Perl gives the match as "b" rather than "ab". I
  2028. # believe this to be a Perl bug.
  2029. /(?>a\Kb)z|(ab)/
  2030. ab\=startchar
  2031. /(?P<L1>(?P<L2>0|)|(?P>L2)(?P>L1))/
  2032. abcd
  2033. 0abc
  2034. /abc(*MARK:)pqr/
  2035. /abc(*:)pqr/
  2036. /(*COMMIT:X)/B
  2037. # This should, and does, fail. In Perl, it does not, which I think is a
  2038. # bug because replacing the B in the pattern by (B|D) does make it fail.
  2039. # Turning off Perl's optimization by inserting (??{""}) also makes it fail.
  2040. /A(*COMMIT)B/aftertext,mark
  2041. \= Expect no match
  2042. ACABX
  2043. # These should be different, but in Perl they are not, which I think
  2044. # is a bug in Perl.
  2045. /A(*THEN)B|A(*THEN)C/mark
  2046. AC
  2047. /A(*PRUNE)B|A(*PRUNE)C/mark
  2048. \= Expect no match
  2049. AC
  2050. # Mark names can be duplicated. Perl doesn't give a mark for this one,
  2051. # though PCRE2 does.
  2052. /^A(*:A)B|^X(*:A)Y/mark
  2053. \= Expect no match
  2054. XAQQ
  2055. # COMMIT at the start of a pattern should be the same as an anchor. Perl
  2056. # optimizations defeat this. So does the PCRE2 optimization unless we disable
  2057. # it.
  2058. /(*COMMIT)ABC/
  2059. ABCDEFG
  2060. /(*COMMIT)ABC/no_start_optimize
  2061. \= Expect no match
  2062. DEFGABC
  2063. /^(ab (c+(*THEN)cd) | xyz)/x
  2064. \= Expect no match
  2065. abcccd
  2066. /^(ab (c+(*PRUNE)cd) | xyz)/x
  2067. \= Expect no match
  2068. abcccd
  2069. /^(ab (c+(*FAIL)cd) | xyz)/x
  2070. \= Expect no match
  2071. abcccd
  2072. # Perl gets some of these wrong
  2073. /(?>.(*ACCEPT))*?5/
  2074. abcde
  2075. /(.(*ACCEPT))*?5/
  2076. abcde
  2077. /(.(*ACCEPT))5/
  2078. abcde
  2079. /(.(*ACCEPT))*5/
  2080. abcde
  2081. /A\NB./B
  2082. ACBD
  2083. \= Expect no match
  2084. A\nB
  2085. ACB\n
  2086. /A\NB./Bs
  2087. ACBD
  2088. ACB\n
  2089. \= Expect no match
  2090. A\nB
  2091. /A\NB/newline=crlf
  2092. A\nB
  2093. A\rB
  2094. \= Expect no match
  2095. A\r\nB
  2096. /\R+b/B
  2097. /\R+\n/B
  2098. /\R+\d/B
  2099. /\d*\R/B
  2100. /\s*\R/B
  2101. \x20\x0a
  2102. \x20\x0d
  2103. \x20\x0d\x0a
  2104. /\S*\R/B
  2105. a\x0a
  2106. /X\h*\R/B
  2107. X\x20\x0a
  2108. /X\H*\R/B
  2109. X\x0d\x0a
  2110. /X\H+\R/B
  2111. X\x0d\x0a
  2112. /X\H++\R/B
  2113. \= Expect no match
  2114. X\x0d\x0a
  2115. /(?<=abc)def/
  2116. abc\=ph
  2117. /abc$/
  2118. abc
  2119. abc\=ps
  2120. abc\=ph
  2121. /abc$/m
  2122. abc
  2123. abc\n
  2124. abc\=ph
  2125. abc\n\=ph
  2126. abc\=ps
  2127. abc\n\=ps
  2128. /abc\z/
  2129. abc
  2130. abc\=ps
  2131. abc\=ph
  2132. /abc\Z/
  2133. abc
  2134. abc\=ps
  2135. abc\=ph
  2136. /abc\b/
  2137. abc
  2138. abc\=ps
  2139. abc\=ph
  2140. /abc\B/
  2141. abc\=ps
  2142. abc\=ph
  2143. \= Expect no match
  2144. abc
  2145. /.+/
  2146. \= Bad offsets
  2147. abc\=offset=4
  2148. abc\=offset=-4
  2149. \= Valid data
  2150. abc\=offset=0
  2151. abc\=offset=1
  2152. abc\=offset=2
  2153. \= Expect no match
  2154. abc\=offset=3
  2155. /^\cģ/
  2156. /(?P<abn>(?P=abn)xxx)/B
  2157. /(a\1z)/B
  2158. /(?P<abn>(?P=abn)(?<badstufxxx)/B
  2159. /(?P<abn>(?P=axn)xxx)/B
  2160. /(?P<abn>(?P=axn)xxx)(?<axn>yy)/B
  2161. # These tests are here because Perl gets the first one wrong.
  2162. /(\R*)(.)/s
  2163. \r\n
  2164. \r\r\n\n\r
  2165. \r\r\n\n\r\n
  2166. /(\R)*(.)/s
  2167. \r\n
  2168. \r\r\n\n\r
  2169. \r\r\n\n\r\n
  2170. /((?>\r\n|\n|\x0b|\f|\r|\x85)*)(.)/s
  2171. \r\n
  2172. \r\r\n\n\r
  2173. \r\r\n\n\r\n
  2174. # -------------
  2175. /^abc$/B
  2176. /^abc$/Bm
  2177. /^(a)*+(\w)/
  2178. aaaaX
  2179. \= Expect no match
  2180. aaaa
  2181. /^(?:a)*+(\w)/
  2182. aaaaX
  2183. \= Expect no match
  2184. aaaa
  2185. /(a)++1234/IB
  2186. /([abc])++1234/I
  2187. /(?<=(abc)+)X/
  2188. /(^ab)/I
  2189. /(^ab)++/I
  2190. /(^ab|^)+/I
  2191. /(^ab|^)++/I
  2192. /(?:^ab)/I
  2193. /(?:^ab)++/I
  2194. /(?:^ab|^)+/I
  2195. /(?:^ab|^)++/I
  2196. /(.*ab)/I
  2197. /(.*ab)++/I
  2198. /(.*ab|.*)+/I
  2199. /(.*ab|.*)++/I
  2200. /(?:.*ab)/I
  2201. /(?:.*ab)++/I
  2202. /(?:.*ab|.*)+/I
  2203. /(?:.*ab|.*)++/I
  2204. /(?=a)[bcd]/I
  2205. /((?=a))[bcd]/I
  2206. /((?=a))+[bcd]/I
  2207. /((?=a))++[bcd]/I
  2208. /(?=a+)[bcd]/Ii
  2209. /(?=a+?)[bcd]/Ii
  2210. /(?=a++)[bcd]/Ii
  2211. /(?=a{3})[bcd]/Ii
  2212. /(abc)\1+/
  2213. # Perl doesn't get these right IMO (the 3rd is PCRE2-specific)
  2214. /(?1)(?:(b(*ACCEPT))){0}/
  2215. b
  2216. /(?1)(?:(b(*ACCEPT))){0}c/
  2217. bc
  2218. \= Expect no match
  2219. b
  2220. /(?1)(?:((*ACCEPT))){0}c/
  2221. c
  2222. c\=notempty
  2223. /^.*?(?(?=a)a|b(*THEN)c)/
  2224. \= Expect no match
  2225. ba
  2226. /^.*?(?(?=a)a|bc)/
  2227. ba
  2228. /^.*?(?(?=a)a(*THEN)b|c)/
  2229. \= Expect no match
  2230. ac
  2231. /^.*?(?(?=a)a(*THEN)b)c/
  2232. \= Expect no match
  2233. ac
  2234. /^.*?(a(*THEN)b)c/
  2235. \= Expect no match
  2236. aabc
  2237. /^.*? (?1) c (?(DEFINE)(a(*THEN)b))/x
  2238. aabc
  2239. /^.*?(a(*THEN)b|z)c/
  2240. aabc
  2241. /^.*?(z|a(*THEN)b)c/
  2242. aabc
  2243. # These are here because they are not Perl-compatible; the studying means the
  2244. # mark is not seen.
  2245. /(*MARK:A)(*SKIP:B)(C|X)/mark
  2246. C
  2247. \= Expect no match
  2248. D
  2249. /(*:A)A+(*SKIP:A)(B|Z)/mark
  2250. \= Expect no match
  2251. AAAC
  2252. # ----------------------------
  2253. "(?=a*(*ACCEPT)b)c"
  2254. c
  2255. c\=notempty
  2256. /(?1)c(?(DEFINE)((*ACCEPT)b))/
  2257. c
  2258. c\=notempty
  2259. /(?>(*ACCEPT)b)c/
  2260. c
  2261. \= Expect no match
  2262. c\=notempty
  2263. /(?:(?>(a)))+a%/allaftertext
  2264. %aa%
  2265. /(a)b|ac/allaftertext
  2266. ac\=ovector=1
  2267. /(a)(b)x|abc/allaftertext
  2268. abc\=ovector=2
  2269. /(a)bc|(a)(b)\2/
  2270. abc\=ovector=1
  2271. abc\=ovector=2
  2272. aba\=ovector=1
  2273. aba\=ovector=2
  2274. aba\=ovector=3
  2275. aba\=ovector=4
  2276. /(?(DEFINE)(a(?2)|b)(b(?1)|a))(?:(?1)|(?2))/I
  2277. /(a(?2)|b)(b(?1)|a)(?:(?1)|(?2))/I
  2278. /(a(?2)|b)(b(?1)|a)(?1)(?2)/I
  2279. /(abc)(?1)/I
  2280. /(?:(foo)|(bar)|(baz))X/allcaptures
  2281. bazfooX
  2282. foobazbarX
  2283. barfooX
  2284. bazX
  2285. foobarbazX
  2286. bazfooX\=ovector=0
  2287. bazfooX\=ovector=1
  2288. bazfooX\=ovector=2
  2289. bazfooX\=ovector=3
  2290. /(?=abc){3}abc/B
  2291. /(?=abc)+abc/B
  2292. /(?=abc)++abc/B
  2293. /(?=abc){0}xyz/B
  2294. /(?=(a))?./B
  2295. /(?=(a))??./B
  2296. /^(?=(a)){0}b(?1)/B
  2297. /(?(DEFINE)(a))?b(?1)/B
  2298. /^(?=(?1))?[az]([abc])d/B
  2299. /^(?!a){0}\w+/B
  2300. /(?<=(abc))?xyz/B
  2301. /[:a[:abc]b:]/B
  2302. /^(a(*:A)(d|e(*:B))z|aeq)/auto_callout
  2303. adz
  2304. aez
  2305. aeqwerty
  2306. /.(*F)/
  2307. \= Expect no match
  2308. abc\=ph
  2309. /\btype\b\W*?\btext\b\W*?\bjavascript\b/I
  2310. /\btype\b\W*?\btext\b\W*?\bjavascript\b|\burl\b\W*?\bshell:|<input\b.*?\btype\b\W*?\bimage\b|\bonkeyup\b\W*?\=/I
  2311. /a(*SKIP)c|b(*ACCEPT)|/I,aftertext
  2312. a
  2313. /a(*SKIP)c|b(*ACCEPT)cd(*ACCEPT)|x/I
  2314. ax
  2315. 'a*(*ACCEPT)b'aftertext
  2316. abc\=notempty_atstart
  2317. bbb\=notempty_atstart
  2318. \= Expect no match
  2319. \=notempty_atstart
  2320. /(*ACCEPT)a/I,aftertext
  2321. bax
  2322. /z(*ACCEPT)a/I,aftertext
  2323. baxzbx
  2324. /^(?>a+)(?>(z+))\w/B
  2325. aaaazzzzb
  2326. \= Expect no match
  2327. aazz
  2328. /(.)(\1|a(?2))/
  2329. bab
  2330. /\1|(.)(?R)\1/
  2331. cbbbc
  2332. /(.)((?(1)c|a)|a(?2))/
  2333. \= Expect no match
  2334. baa
  2335. /(?P<abn>(?P=abn)xxx)/B
  2336. /(a\1z)/B
  2337. /^a\x41z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2338. aAz
  2339. \= Expect no match
  2340. ax41z
  2341. /^a[m\x41]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2342. aAz
  2343. /^a\x1z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2344. ax1z
  2345. /^a\u0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2346. aAz
  2347. \= Expect no match
  2348. au0041z
  2349. /^a[m\u0041]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2350. aAz
  2351. /^a\u041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2352. au041z
  2353. \= Expect no match
  2354. aAz
  2355. /^a\U0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
  2356. aU0041z
  2357. \= Expect no match
  2358. aAz
  2359. /^\u{7a}/alt_bsux
  2360. u{7a}
  2361. \= Expect no match
  2362. zoo
  2363. /^\u{7a}/extra_alt_bsux
  2364. zoo
  2365. /\u{}/extra_alt_bsux
  2366. u{}
  2367. /\u{Q12}/extra_alt_bsux
  2368. --u{Q12}--
  2369. /\u{ 12}/extra_alt_bsux
  2370. --u{ 12}--
  2371. /\u{{3}}/extra_alt_bsux
  2372. --u{{{}--
  2373. /(?(?=c)c|d)++Y/B
  2374. /(?(?=c)c|d)*+Y/B
  2375. /a[\NB]c/
  2376. aNc
  2377. /a[B-\Nc]/
  2378. /a[B\Nc]/
  2379. /(a)(?2){0,1999}?(b)/
  2380. /(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/
  2381. # This test, with something more complicated than individual letters, causes
  2382. # different behaviour in Perl. Perhaps it disables some optimization; no tag is
  2383. # passed back for the failures, whereas in PCRE2 there is a tag.
  2384. /(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/x,mark
  2385. AABC
  2386. XXYZ
  2387. \= Expect no match
  2388. XAQQ
  2389. XAQQXZZ
  2390. AXQQQ
  2391. AXXQQQ
  2392. # Perl doesn't give marks for these, though it does if the alternatives are
  2393. # replaced by single letters.
  2394. /(b|q)(*:m)f|a(*:n)w/mark
  2395. aw
  2396. \= Expect no match
  2397. abc
  2398. /(q|b)(*:m)f|a(*:n)w/mark
  2399. aw
  2400. \= Expect no match
  2401. abc
  2402. # After a partial match, the behaviour is as for a failure.
  2403. /^a(*:X)bcde/mark
  2404. abc\=ps
  2405. # These are here because Perl doesn't return a mark, except for the first.
  2406. /(?=(*:x))(q|)/aftertext,mark
  2407. abc
  2408. /(?=(*:x))((*:y)q|)/aftertext,mark
  2409. abc
  2410. /(?=(*:x))(?:(*:y)q|)/aftertext,mark
  2411. abc
  2412. /(?=(*:x))(?>(*:y)q|)/aftertext,mark
  2413. abc
  2414. /(?=a(*:x))(?!a(*:y)c)/aftertext,mark
  2415. ab
  2416. /(?=a(*:x))(?=a(*:y)c|)/aftertext,mark
  2417. ab
  2418. /(..)\1/
  2419. ab\=ps
  2420. aba\=ps
  2421. abab\=ps
  2422. /(..)\1/i
  2423. ab\=ps
  2424. abA\=ps
  2425. aBAb\=ps
  2426. /(..)\1{2,}/
  2427. ab\=ps
  2428. aba\=ps
  2429. abab\=ps
  2430. ababa\=ps
  2431. ababab\=ps
  2432. ababab\=ph
  2433. abababa\=ps
  2434. abababa\=ph
  2435. /(..)\1{2,}/i
  2436. ab\=ps
  2437. aBa\=ps
  2438. aBAb\=ps
  2439. AbaBA\=ps
  2440. abABAb\=ps
  2441. aBAbaB\=ph
  2442. abABabA\=ps
  2443. abaBABa\=ph
  2444. /(..)\1{2,}?x/i
  2445. ab\=ps
  2446. abA\=ps
  2447. aBAb\=ps
  2448. abaBA\=ps
  2449. abAbaB\=ps
  2450. abaBabA\=ps
  2451. abAbABaBx\=ps
  2452. /^(..)\1/
  2453. aba\=ps
  2454. /^(..)\1{2,3}x/
  2455. aba\=ps
  2456. ababa\=ps
  2457. ababa\=ph
  2458. abababx
  2459. ababababx
  2460. /^(..)\1{2,3}?x/
  2461. aba\=ps
  2462. ababa\=ps
  2463. ababa\=ph
  2464. abababx
  2465. ababababx
  2466. /^(..)(\1{2,3})ab/
  2467. abababab
  2468. /^\R/
  2469. \r\=ps
  2470. \r\=ph
  2471. /^\R{2,3}x/
  2472. \r\=ps
  2473. \r\=ph
  2474. \r\r\=ps
  2475. \r\r\=ph
  2476. \r\r\r\=ps
  2477. \r\r\r\=ph
  2478. \r\rx
  2479. \r\r\rx
  2480. /^\R{2,3}?x/
  2481. \r\=ps
  2482. \r\=ph
  2483. \r\r\=ps
  2484. \r\r\=ph
  2485. \r\r\r\=ps
  2486. \r\r\r\=ph
  2487. \r\rx
  2488. \r\r\rx
  2489. /^\R?x/
  2490. \r\=ps
  2491. \r\=ph
  2492. x
  2493. \rx
  2494. /^\R+x/
  2495. \r\=ps
  2496. \r\=ph
  2497. \r\n\=ps
  2498. \r\n\=ph
  2499. \rx
  2500. /^a$/newline=crlf
  2501. a\r\=ps
  2502. a\r\=ph
  2503. /^a$/m,newline=crlf
  2504. a\r\=ps
  2505. a\r\=ph
  2506. /^(a$|a\r)/newline=crlf
  2507. a\r\=ps
  2508. a\r\=ph
  2509. /^(a$|a\r)/m,newline=crlf
  2510. a\r\=ps
  2511. a\r\=ph
  2512. /./newline=crlf
  2513. \r\=ps
  2514. \r\=ph
  2515. /.{2,3}/newline=crlf
  2516. \r\=ps
  2517. \r\=ph
  2518. \r\r\=ps
  2519. \r\r\=ph
  2520. \r\r\r\=ps
  2521. \r\r\r\=ph
  2522. /.{2,3}?/newline=crlf
  2523. \r\=ps
  2524. \r\=ph
  2525. \r\r\=ps
  2526. \r\r\=ph
  2527. \r\r\r\=ps
  2528. \r\r\r\=ph
  2529. "AB(C(D))(E(F))?(?(?=\2)(?=\4))"
  2530. ABCDGHI\=ovector=01
  2531. # These are all run as real matches in test 1; here we are just checking the
  2532. # settings of the anchored and startline bits.
  2533. /(?>.*?a)(?<=ba)/I
  2534. /(?:.*?a)(?<=ba)/I
  2535. /.*?a(*PRUNE)b/I
  2536. /.*?a(*PRUNE)b/Is
  2537. /^a(*PRUNE)b/Is
  2538. /.*?a(*SKIP)b/I
  2539. /(?>.*?a)b/Is
  2540. /(?>.*?a)b/I
  2541. /(?>^a)b/Is
  2542. /(?>.*?)(?<=(abcd)|(wxyz))/I
  2543. /(?>.*)(?<=(abcd)|(wxyz))/I
  2544. "(?>.*)foo"I
  2545. "(?>.*?)foo"I
  2546. /(?>^abc)/Im
  2547. /(?>.*abc)/Im
  2548. /(?:.*abc)/Im
  2549. /(?:(a)+(?C1)bb|aa(?C2)b)/
  2550. aab\=callout_capture
  2551. /(?:(a)++(?C1)bb|aa(?C2)b)/
  2552. aab\=callout_capture
  2553. /(?:(?>(a))(?C1)bb|aa(?C2)b)/
  2554. aab\=callout_capture
  2555. /(?:(?1)(?C1)x|ab(?C2))((a)){0}/
  2556. aab\=callout_capture
  2557. /(?1)(?C1)((a)(?C2)){0}/
  2558. aab\=callout_capture
  2559. /(?:(a)+(?C1)bb|aa(?C2)b)++/
  2560. aab\=callout_capture
  2561. aab\=callout_capture,ovector=1
  2562. /(ab)x|ab/
  2563. ab\=ovector=0
  2564. ab\=ovector=1
  2565. /(?<=123)(*MARK:xx)abc/mark
  2566. xxxx123a\=ph
  2567. xxxx123a\=ps
  2568. /123\Kabc/startchar
  2569. xxxx123a\=ph
  2570. xxxx123a\=ps
  2571. /^(?(?=a)aa|bb)/auto_callout
  2572. bb
  2573. /(?C1)^(?C2)(?(?C99)(?=(?C3)a(?C4))(?C5)a(?C6)a(?C7)|(?C8)b(?C9)b(?C10))(?C11)/
  2574. bb
  2575. # Perl seems to have a bug with this one.
  2576. /aaaaa(*COMMIT)(*PRUNE)b|a+c/
  2577. aaaaaac
  2578. # Here are some that Perl treats differently because of the way it handles
  2579. # backtracking verbs.
  2580. /(?!a(*COMMIT)b)ac|ad/
  2581. ac
  2582. ad
  2583. /^(?!a(*THEN)b|ac)../
  2584. ad
  2585. \= Expect no match
  2586. ac
  2587. /^(?=a(*THEN)b|ac)/
  2588. ac
  2589. /\A.*?(?:a|b(*THEN)c)/
  2590. ba
  2591. /\A.*?(?:a|b(*THEN)c)++/
  2592. ba
  2593. /\A.*?(?:a|b(*THEN)c|d)/
  2594. ba
  2595. /(?:(a(*MARK:X)a+(*SKIP:X)b)){0}(?:(?1)|aac)/
  2596. aac
  2597. /\A.*?(a|b(*THEN)c)/
  2598. ba
  2599. /^(A(*THEN)B|A(*THEN)D)/
  2600. AD
  2601. /(?!b(*THEN)a)bn|bnn/
  2602. bnn
  2603. /(?(?=b(*SKIP)a)bn|bnn)/
  2604. bnn
  2605. /(?=b(*THEN)a|)bn|bnn/
  2606. bnn
  2607. # This test causes a segfault with Perl 5.18.0
  2608. /^(?=(a)){0}b(?1)/
  2609. backgammon
  2610. /(?|(?<n>f)|(?<n>b))/I,dupnames
  2611. /(?<a>abc)(?<a>z)\k<a>()/IB,dupnames
  2612. /a*[bcd]/B
  2613. /[bcd]*a/B
  2614. # A complete set of tests for auto-possessification of character types, but
  2615. # omitting \C because it might be disabled (it has its own tests).
  2616. /\D+\D \D+\d \D+\S \D+\s \D+\W \D+\w \D+. \D+\R \D+\H \D+\h \D+\V \D+\v \D+\Z \D+\z \D+$/Bx
  2617. /\d+\D \d+\d \d+\S \d+\s \d+\W \d+\w \d+. \d+\R \d+\H \d+\h \d+\V \d+\v \d+\Z \d+\z \d+$/Bx
  2618. /\S+\D \S+\d \S+\S \S+\s \S+\W \S+\w \S+. \S+\R \S+\H \S+\h \S+\V \S+\v \S+\Z \S+\z \S+$/Bx
  2619. /\s+\D \s+\d \s+\S \s+\s \s+\W \s+\w \s+. \s+\R \s+\H \s+\h \s+\V \s+\v \s+\Z \s+\z \s+$/Bx
  2620. /\W+\D \W+\d \W+\S \W+\s \W+\W \W+\w \W+. \W+\R \W+\H \W+\h \W+\V \W+\v \W+\Z \W+\z \W+$/Bx
  2621. /\w+\D \w+\d \w+\S \w+\s \w+\W \w+\w \w+. \w+\R \w+\H \w+\h \w+\V \w+\v \w+\Z \w+\z \w+$/Bx
  2622. /\R+\D \R+\d \R+\S \R+\s \R+\W \R+\w \R+. \R+\R \R+\H \R+\h \R+\V \R+\v \R+\Z \R+\z \R+$/Bx
  2623. /\H+\D \H+\d \H+\S \H+\s \H+\W \H+\w \H+. \H+\R \H+\H \H+\h \H+\V \H+\v \H+\Z \H+\z \H+$/Bx
  2624. /\h+\D \h+\d \h+\S \h+\s \h+\W \h+\w \h+. \h+\R \h+\H \h+\h \h+\V \h+\v \h+\Z \h+\z \h+$/Bx
  2625. /\V+\D \V+\d \V+\S \V+\s \V+\W \V+\w \V+. \V+\R \V+\H \V+\h \V+\V \V+\v \V+\Z \V+\z \V+$/Bx
  2626. /\v+\D \v+\d \v+\S \v+\s \v+\W \v+\w \v+. \v+\R \v+\H \v+\h \v+\V \v+\v \v+\Z \v+\z \v+$/Bx
  2627. / a+\D a+\d a+\S a+\s a+\W a+\w a+. a+\R a+\H a+\h a+\V a+\v a+\Z a+\z a+$/Bx
  2628. /\n+\D \n+\d \n+\S \n+\s \n+\W \n+\w \n+. \n+\R \n+\H \n+\h \n+\V \n+\v \n+\Z \n+\z \n+$/Bx
  2629. / .+\D .+\d .+\S .+\s .+\W .+\w .+. .+\R .+\H .+\h .+\V .+\v .+\Z .+\z .+$/Bx
  2630. / .+\D .+\d .+\S .+\s .+\W .+\w .+. .+\R .+\H .+\h .+\V .+\v .+\Z .+\z .+$/Bsx
  2631. / \D+$ \d+$ \S+$ \s+$ \W+$ \w+$ \R+$ \H+$ \h+$ \V+$ \v+$ a+$ \n+$ .+$ .+$/Bmx
  2632. /(?=a+)a(a+)++a/B
  2633. /a+(bb|cc)a+(?:bb|cc)a+(?>bb|cc)a+(?:bb|cc)+a+(aa)a+(?:bb|aa)/B
  2634. /a+(bb|cc)?#a+(?:bb|cc)??#a+(?:bb|cc)?+#a+(?:bb|cc)*#a+(bb|cc)?a#a+(?:aa)?/B
  2635. /a+(?:bb)?a#a+(?:|||)#a+(?:|b)a#a+(?:|||)?a/B
  2636. /[ab]*/B
  2637. aaaa
  2638. /[ab]*?/B
  2639. aaaa
  2640. /[ab]?/B
  2641. aaaa
  2642. /[ab]??/B
  2643. aaaa
  2644. /[ab]+/B
  2645. aaaa
  2646. /[ab]+?/B
  2647. aaaa
  2648. /[ab]{2,3}/B
  2649. aaaa
  2650. /[ab]{2,3}?/B
  2651. aaaa
  2652. /[ab]{2,}/B
  2653. aaaa
  2654. /[ab]{2,}?/B
  2655. aaaa
  2656. /\d+\s{0,5}=\s*\S?=\w{0,4}\W*/B
  2657. /[a-d]{5,12}[e-z0-9]*#[^a-z]+[b-y]*a[2-7]?[^0-9a-z]+/B
  2658. /[a-z]*\s#[ \t]?\S#[a-c]*\S#[C-G]+?\d#[4-8]*\D#[4-9,]*\D#[!$]{0,5}\w#[M-Xf-l]+\W#[a-c,]?\W/B
  2659. /a+(aa|bb)*c#a*(bb|cc)*a#a?(bb|cc)*d#[a-f]*(g|hh)*f/B
  2660. /[a-f]*(g|hh|i)*i#[a-x]{4,}(y{0,6})*y#[a-k]+(ll|mm)+n/B
  2661. /[a-f]*(?>gg|hh)+#[a-f]*(?>gg|hh)?#[a-f]*(?>gg|hh)*a#[a-f]*(?>gg|hh)*h/B
  2662. /[a-c]*d/IB
  2663. /[a-c]+d/IB
  2664. /[a-c]?d/IB
  2665. /[a-c]{4,6}d/IB
  2666. /[a-c]{0,6}d/IB
  2667. # End of special auto-possessive tests
  2668. /^A\o{1239}B/
  2669. A\123B
  2670. /^A\oB/
  2671. /^A\x{zz}B/
  2672. /^A\x{12Z/
  2673. /^A\x{/
  2674. /[ab]++/B,no_auto_possess
  2675. /[^ab]*+/B,no_auto_possess
  2676. /a{4}+/B,no_auto_possess
  2677. /a{4}+/Bi,no_auto_possess
  2678. /[a-[:digit:]]+/
  2679. /[A-[:digit:]]+/
  2680. /[a-[.xxx.]]+/
  2681. /[a-[=xxx=]]+/
  2682. /[a-[!xxx!]]+/
  2683. /[A-[!xxx!]]+/
  2684. A]]]
  2685. /[a-\d]+/
  2686. /(?<0abc>xx)/
  2687. /(?&1abc)xx(?<1abc>y)/
  2688. /(?<ab-cd>xx)/
  2689. /(?'0abc'xx)/
  2690. /(?P<0abc>xx)/
  2691. /\k<5ghj>/
  2692. /\k'5ghj'/
  2693. /\k{2fgh}/
  2694. /(?P=8yuki)/
  2695. /\g{4df}/
  2696. /(?&1abc)xx(?<1abc>y)/
  2697. /(?P>1abc)xx(?<1abc>y)/
  2698. /\g'3gh'/
  2699. /\g<5fg>/
  2700. /(?(<4gh>)abc)/
  2701. /(?('4gh')abc)/
  2702. /(?(4gh)abc)/
  2703. /(?(R&6yh)abc)/
  2704. /(((a\2)|(a*)\g<-1>))*a?/B
  2705. # Test the ugly "start or end of word" compatibility syntax.
  2706. /[[:<:]]red[[:>:]]/B
  2707. little red riding hood
  2708. a /red/ thing
  2709. red is a colour
  2710. put it all on red
  2711. \= Expect no match
  2712. no reduction
  2713. Alfred Winifred
  2714. /[a[:<:]] should give error/
  2715. /(?=ab\K)/aftertext,allow_lookaround_bsk
  2716. abcd\=startchar
  2717. /abcd/newline=lf,firstline
  2718. \= Expect no match
  2719. xx\nxabcd
  2720. # Test stack guard external calls.
  2721. /(((a)))/stackguard=1
  2722. /(((a)))/stackguard=2
  2723. /(((a)))/stackguard=3
  2724. /(((((a)))))/
  2725. # End stack guard tests
  2726. /^\w+(?>\s*)(?<=\w)/B
  2727. /\othing/
  2728. /\o{}/
  2729. /\o{whatever}/
  2730. /\xthing/
  2731. /\x{}/
  2732. /\x{whatever}/
  2733. /A\8B/
  2734. /A\9B/
  2735. # This one is here because Perl fails to match "12" for this pattern when the $
  2736. # is present.
  2737. /^(?(?=abc)\w{3}:|\d\d)$/
  2738. abc:
  2739. 12
  2740. \= Expect no match
  2741. 123
  2742. xyz
  2743. # Perl gets this one wrong, giving "a" as the after text for ca and failing to
  2744. # match for cd.
  2745. /(?(?=ab)ab)/aftertext
  2746. abxxx
  2747. ca
  2748. cd
  2749. # This should test both paths for processing OP_RECURSE.
  2750. /(?(R)a+|(?R)b)/
  2751. aaaabcde
  2752. aaaabcde\=ovector=100
  2753. /a*?b*?/
  2754. ab
  2755. /(*NOTEMPTY)a*?b*?/
  2756. ab
  2757. ba
  2758. cb
  2759. /(*NOTEMPTY_ATSTART)a*?b*?/aftertext
  2760. ab
  2761. cdab
  2762. /(?(VERSION>=10.0)yes|no)/I
  2763. yesno
  2764. /(?(VERSION>=10.04)yes|no)/
  2765. yesno
  2766. /(?(VERSION=8)yes){3}/BI,aftertext
  2767. yesno
  2768. /(?(VERSION=8)yes|no){3}/I
  2769. yesnononoyes
  2770. \= Expect no match
  2771. yesno
  2772. /(?:(?<VERSION>abc)|xyz)(?(VERSION)yes|no)/I
  2773. abcyes
  2774. xyzno
  2775. \= Expect no match
  2776. abcno
  2777. xyzyes
  2778. /(?(VERSION<10)yes|no)/
  2779. /(?(VERSION>10)yes|no)/
  2780. /(?(VERSION>=10.0.0)yes|no)/
  2781. /(?(VERSION=10.101)yes|no)/
  2782. /abcd/I
  2783. /abcd/I,no_start_optimize
  2784. /(|ab)*?d/I
  2785. abd
  2786. xyd
  2787. /(|ab)*?d/I,no_start_optimize
  2788. abd
  2789. xyd
  2790. /\k<A>*(?<A>aa)(?<A>bb)/match_unset_backref,dupnames
  2791. aabb
  2792. /(((((a)))))/parens_nest_limit=2
  2793. /abc/replace=XYZ
  2794. 123123
  2795. 123abc123
  2796. 123abc123abc123
  2797. 123123\=zero_terminate
  2798. 123abc123\=zero_terminate
  2799. 123abc123abc123\=zero_terminate
  2800. /abc/g,replace=XYZ
  2801. 123abc123
  2802. 123abc123abc123
  2803. /abc/replace=X$$Z
  2804. 123abc123
  2805. /abc/g,replace=X$$Z
  2806. 123abc123abc123
  2807. /a(b)c(d)e/replace=X$1Y${2}Z
  2808. "abcde"
  2809. /a(b)c(d)e/replace=X$1Y${2}Z,global
  2810. "abcde-abcde"
  2811. /a(?<ONE>b)c(?<TWO>d)e/replace=X$ONE+${TWO}Z
  2812. "abcde"
  2813. /a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z
  2814. "abcde-abcde-"
  2815. /abc/replace=a$++
  2816. 123abc
  2817. /abc/replace=a$bad
  2818. 123abc
  2819. /abc/replace=a${A234567890123456789_123456789012}z
  2820. 123abc
  2821. /abc/replace=a${A23456789012345678901234567890123}z
  2822. 123abc
  2823. /abc/replace=a${bcd
  2824. 123abc
  2825. /abc/replace=a${b+d}z
  2826. 123abc
  2827. /abc/replace=[10]XYZ
  2828. 123abc123
  2829. /abc/replace=[9]XYZ
  2830. 123abc123
  2831. /abc/replace=xyz
  2832. 1abc2\=partial_hard
  2833. /abc/replace=xyz
  2834. 123abc456
  2835. 123abc456\=replace=pqr
  2836. 123abc456abc789
  2837. 123abc456abc789\=g
  2838. /(?<=abc)(|def)/g,replace=<$0>
  2839. 123abcxyzabcdef789abcpqr
  2840. /./replace=$0
  2841. a
  2842. /(.)(.)/replace=$2+$1
  2843. abc
  2844. /(?<A>.)(?<B>.)/replace=$B+$A
  2845. abc
  2846. /(.)(.)/g,replace=$2$1
  2847. abcdefgh
  2848. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=${*MARK}
  2849. apple lemon blackberry
  2850. apple strudel
  2851. fruitless
  2852. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} sauce,
  2853. apple lemon blackberry
  2854. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK>
  2855. apple lemon blackberry
  2856. apple strudel
  2857. fruitless
  2858. /(*:pear)apple/g,replace=${*MARKING}
  2859. apple lemon blackberry
  2860. /(*:pear)apple/g,replace=${*MARK-time
  2861. apple lemon blackberry
  2862. /(*:pear)apple/g,replace=${*mark}
  2863. apple lemon blackberry
  2864. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARKET>
  2865. apple lemon blackberry
  2866. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[22]${*MARK}
  2867. apple lemon blackberry
  2868. apple lemon blackberry\=substitute_overflow_length
  2869. /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[23]${*MARK}
  2870. apple lemon blackberry
  2871. /abc/
  2872. 123abc123\=replace=[9]XYZ
  2873. 123abc123\=substitute_overflow_length,replace=[9]XYZ
  2874. 123abc123\=substitute_overflow_length,replace=[6]XYZ
  2875. 123abc123\=substitute_overflow_length,replace=[1]XYZ
  2876. 123abc123\=substitute_overflow_length,replace=[0]XYZ
  2877. /a(b)c/
  2878. 123abc123\=replace=[9]x$1z
  2879. 123abc123\=substitute_overflow_length,replace=[9]x$1z
  2880. 123abc123\=substitute_overflow_length,replace=[6]x$1z
  2881. 123abc123\=substitute_overflow_length,replace=[1]x$1z
  2882. 123abc123\=substitute_overflow_length,replace=[0]x$1z
  2883. "((?=(?(?=(?(?=(?(?=()))))))))"
  2884. a
  2885. "(?(?=)==)(((((((((?=)))))))))"
  2886. \= Expect no match
  2887. a
  2888. /(a)(b)|(c)/
  2889. XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
  2890. /x(?=ab\K)/allow_lookaround_bsk
  2891. xab\=get=0
  2892. xab\=copy=0
  2893. xab\=getall
  2894. /(?<A>a)|(?<A>b)/dupnames
  2895. a\=ovector=1,copy=A,get=A,get=2
  2896. a\=ovector=2,copy=A,get=A,get=2
  2897. b\=ovector=2,copy=A,get=A,get=2
  2898. /a(b)c(d)/
  2899. abc\=ph,copy=0,copy=1,getall
  2900. /^abc/info
  2901. /^abc/info,no_dotstar_anchor
  2902. /.*\d/info,auto_callout
  2903. \= Expect no match
  2904. aaa
  2905. /.*\d/info,no_dotstar_anchor,auto_callout
  2906. \= Expect no match
  2907. aaa
  2908. /.*\d/dotall,info
  2909. /.*\d/dotall,no_dotstar_anchor,info
  2910. /(*NO_DOTSTAR_ANCHOR)(?s).*\d/info
  2911. '^(?:(a)|b)(?(1)A|B)'
  2912. aA123\=ovector=1
  2913. aA123\=ovector=2
  2914. '^(?:(?<AA>a)|b)(?(<AA>)A|B)'
  2915. aA123\=ovector=1
  2916. aA123\=ovector=2
  2917. '^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'dupnames
  2918. aA123\=ovector=1
  2919. aA123\=ovector=2
  2920. aA123\=ovector=3
  2921. '^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'dupnames
  2922. aa123\=ovector=1
  2923. aa123\=ovector=2
  2924. aa123\=ovector=3
  2925. /(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
  2926. /(?<N>(?J)(?<N>))(?-J)\k<N>/
  2927. # Quantifiers are not allowed on condition assertions, but are otherwise
  2928. # OK in conditions.
  2929. /(?(?=0)?)+/
  2930. /(?(?=0)(?=00)?00765)/
  2931. 00765
  2932. /(?(?=0)(?=00)?00765|(?!3).56)/
  2933. 00765
  2934. 456
  2935. \= Expect no match
  2936. 356
  2937. '^(a)*+(\w)'
  2938. g
  2939. g\=ovector=1
  2940. '^(?:a)*+(\w)'
  2941. g
  2942. g\=ovector=1
  2943. # These two pattern showeds up compile-time bugs
  2944. "((?2){0,1999}())?"
  2945. /((?+1)(\1))/B
  2946. # Callouts with string arguments
  2947. /a(?C"/
  2948. /a(?C"a/
  2949. /a(?C"a"/
  2950. /a(?C"a"bcde(?C"b")xyz/
  2951. /a(?C"a)b""c")/B
  2952. /ab(?C" any text with spaces ")cde/B
  2953. abcde
  2954. 12abcde
  2955. /^a(b)c(?C1)def/
  2956. abcdef
  2957. /^a(b)c(?C"AB")def/
  2958. abcdef
  2959. /^a(b)c(?C1)def/
  2960. abcdef\=callout_capture
  2961. /^a(b)c(?C{AB})def/B
  2962. abcdef\=callout_capture
  2963. /(?C`a``b`)(?C'a''b')(?C"a""b")(?C^a^^b^)(?C%a%%b%)(?C#a##b#)(?C$a$$b$)(?C{a}}b})/B,callout_info
  2964. /(?:a(?C`code`)){3}/B
  2965. /^(?(?C25)(?=abc)abcd|xyz)/B,callout_info
  2966. abcdefg
  2967. xyz123
  2968. /^(?(?C$abc$)(?=abc)abcd|xyz)/B
  2969. abcdefg
  2970. xyz123
  2971. /^ab(?C'first')cd(?C"second")ef/
  2972. abcdefg
  2973. /(?:a(?C`code`)){3}X/
  2974. aaaXY
  2975. # Binary zero in callout string
  2976. # a ( ? C ' x z ' ) b
  2977. / 61 28 3f 43 27 78 00 7a 27 29 62/hex,callout_info
  2978. abcdefgh
  2979. /(?(?!)^)/
  2980. /(?(?!)a|b)/
  2981. bbb
  2982. \= Expect no match
  2983. aaa
  2984. # JIT gives a different error message for the infinite recursion
  2985. "(*NO_JIT)((?2)+)((?1)){"
  2986. abcd{
  2987. # Perl fails to diagnose the absence of an assertion
  2988. "(?(?<E>.*!.*)?)"
  2989. "X((?2)()*+){2}+"B
  2990. "X((?2)()*+){2}"B
  2991. /(?<=\bABQ(3(?-7)))/
  2992. /(?<=\bABQ(3(?+7)))/
  2993. ";(?<=()((?3))((?2)))"
  2994. # Perl loops on this (PCRE2 used to!)
  2995. /(?<=\Ka)/g,aftertext,allow_lookaround_bsk
  2996. aaaaa
  2997. /(?<=\Ka)/altglobal,aftertext,allow_lookaround_bsk
  2998. aaaaa
  2999. /((?2){73}(?2))((?1))/info
  3000. /abc/
  3001. \= Expect no match
  3002. \[9x!xxx(]{9999}
  3003. /(abc)*/
  3004. \[abc]{5}
  3005. /^/gm
  3006. \n\n\n
  3007. /^/gm,alt_circumflex
  3008. \n\n\n
  3009. /((((((((x))))))))\81/
  3010. xx1
  3011. /((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\80/
  3012. xx
  3013. /\80/
  3014. /A\8B\9C/
  3015. A8B9C
  3016. /(?x:((?'a')) # comment (with parentheses) and | vertical
  3017. (?-x:#not a comment (?'b')) # this is a comment ()
  3018. (?'c')) # not a comment (?'d')/info
  3019. /(?|(?'a')(2)(?'b')|(?'a')(?'a')(3))/I,dupnames
  3020. A23B
  3021. B32A
  3022. # These are some patterns that used to cause buffer overflows or other errors
  3023. # while compiling.
  3024. /.((?2)(?R)|\1|$)()/B
  3025. /.((?3)(?R)()(?2)|\1|$)()/B
  3026. /(\9*+(?2);\3++()2|)++{/
  3027. /\V\x85\9*+((?2)\3++()2)*:2/
  3028. /(((?(R)){0,2}) (?'x'((?'R')((?'R')))))/dupnames
  3029. /(((?(X)){0,2}) (?'x'((?'X')((?'X')))))/dupnames
  3030. /(((?(R)){0,2}) (?'x'((?'X')((?'R')))))/
  3031. "(?J)(?'d'(?'d'\g{d}))"
  3032. "(?=!((?2)(?))({8(?<=(?1){29}8bbbb\x16\xd\xc6^($(\xa9H4){4}h}?1)B))\x15')"
  3033. /A(?'')Z/
  3034. "(?J:(?|(?'R')(\k'R')|((?'R'))))"
  3035. /(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
  3036. /^(?:(?(1)x|)+)+$()/B
  3037. /[[:>:]](?<)/
  3038. /((?x)(*:0))#(?'/
  3039. /(?C$[$)(?<]/
  3040. /(?C$)$)(?<]/
  3041. /(?(R))*+/B
  3042. abcd
  3043. /((?x)(?#))#(?'/
  3044. /((?x)(?#))#(?'abc')/I
  3045. /[[:\\](?<[::]/
  3046. /[[:\\](?'abc')[a:]/I
  3047. "[[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[:::::::::::::::::[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[[[:::E[[[:[:[[:[:::[[:::E[[[:[:[[:'[:::::E[[[:[::::::[[[:[[[[[[[::E[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
  3048. /()(?(R)0)*+/B
  3049. /(?R-:(?</
  3050. /(?R-:(?<)/
  3051. /(?(?C{\Q})(?!(?'/
  3052. /(?(?C{\Q})(?!(?'abc')))/I
  3053. /(?1){3918}(((((0(\k'R'))))(?J)(?'R'(?'R'\3){99})))/I
  3054. /(?|(aaa)|(b))\g{1}/I
  3055. /(?|(aaa)|(b))(?1)/I
  3056. /(?|(aaa)|(b))/I
  3057. /(?|(?'a'aaa)|(?'a'b))\k'a'/I
  3058. /(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/I,dupnames
  3059. /ab{3cd/
  3060. ab{3cd
  3061. /ab{3,cd/
  3062. ab{3,cd
  3063. /ab{3,4a}cd/
  3064. ab{3,4a}cd
  3065. /{4,5a}bc/
  3066. {4,5a}bc
  3067. /\x0{ab}/
  3068. \0{ab}
  3069. /^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
  3070. ababababbbabZXXXX
  3071. /.*?a(*PRUNE)b/
  3072. aab
  3073. /.*?a(*PRUNE)b/s
  3074. aab
  3075. /^a(*PRUNE)b/s
  3076. \= Expect no match
  3077. aab
  3078. /.*?a(*SKIP)b/
  3079. aab
  3080. /(?(8000000000/
  3081. /((?(R8000000000)))/
  3082. /0(?0)|(1)(*THEN)(*SKIP:0)(*FAIL)/
  3083. \= Expect no match
  3084. 01
  3085. /(?(1)()\983040\2)/
  3086. /(*LIMIT_MATCH=)abc/
  3087. /(*CRLF)(*LIMIT_MATCH=)abc/
  3088. /(?:ab)?(?:ab)(?:ab)/
  3089. abab
  3090. ababab
  3091. \= Expect no match
  3092. aba
  3093. /((*MARK:A))++a(*SKIP:B)b/
  3094. \= Expect no match
  3095. aacb
  3096. /(*MARK:a\zb)z/alt_verbnames
  3097. /(*:ab\t(d\)c)xxx/
  3098. /(*:ab\t(d\)c)xxx/alt_verbnames,mark
  3099. cxxxz
  3100. /(*:A\Qxx)x\EB)x/alt_verbnames,mark
  3101. x
  3102. /(*:A\ExxxB)x/alt_verbnames,mark
  3103. x
  3104. /(*: A \ and #comment
  3105. \ B)x/x,alt_verbnames,mark
  3106. x
  3107. /(*: A \ and #comment
  3108. \ B)x/alt_verbnames,mark
  3109. x
  3110. /(*: A \ and #comment
  3111. \ B)x/x,mark
  3112. x
  3113. /(*: A \ and #comment
  3114. \ B)x/mark
  3115. x
  3116. /(*:A
  3117. B)x/alt_verbnames,mark
  3118. x
  3119. /(*:abc\Qpqr)/alt_verbnames
  3120. /abc/use_offset_limit
  3121. 1234abcde\=offset_limit=100
  3122. 1234abcde\=offset_limit=9
  3123. 1234abcde\=offset_limit=4
  3124. 1234abcde\=offset_limit=4,offset=4
  3125. \= Expect no match
  3126. 1234abcde\=offset_limit=4,offset=5
  3127. 1234abcde\=offset_limit=3
  3128. /(?<=abc)/use_offset_limit
  3129. 1234abc\=offset_limit=7
  3130. \= Expect no match
  3131. 1234abc\=offset_limit=6
  3132. /A/g,replace=-,use_offset_limit
  3133. XAXAXAXAXA\=offset_limit=4
  3134. /abc/
  3135. \= Expect error
  3136. 1234abcde\=offset_limit=4
  3137. /^\w/m,use_offset_limit
  3138. \n..\naa\=offset_limit=3
  3139. \n..\naa\=offset_limit=4
  3140. /abcd/null_context
  3141. abcd\=null_context
  3142. \= Expect error - not allowed together
  3143. abcd\=null_context,find_limits
  3144. abcd\=allusedtext,startchar
  3145. /abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended
  3146. abcd
  3147. /abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended,substitute_literal
  3148. >>abcd<<
  3149. /abcd/g,replace=\$1$2\,substitute_literal
  3150. XabcdYabcdZ
  3151. /a(bc)(DE)/replace=a\u$1\U$1\E$1\l$2\L$2\Eab\Uab\LYZ\EDone,substitute_extended
  3152. abcDE
  3153. /abcd/replace=xy\kz,substitute_extended
  3154. abcd
  3155. /a(?:(b)|(c))/substitute_extended,replace=X${1:+1:-1}X${2:+2:-2}
  3156. ab
  3157. ac
  3158. ab\=replace=${1:+$1\:$1:$2}
  3159. ac\=replace=${1:+$1\:$1:$2}
  3160. >>ac<<\=replace=${1:+$1\:$1:$2},substitute_literal
  3161. /a(?:(b)|(c))/substitute_extended,replace=X${1:-1:-1}X${2:-2:-2}
  3162. ab
  3163. ac
  3164. /(a)/substitute_extended,replace=>${1:+\Q$1:{}$$\E+\U$1}<
  3165. a
  3166. /X(b)Y/substitute_extended
  3167. XbY\=replace=x${1:+$1\U$1}y
  3168. XbY\=replace=\Ux${1:+$1$1}y
  3169. /a/substitute_extended,replace=${*MARK:+a:b}
  3170. a
  3171. /(abcd)/replace=${1:+xy\kz},substitute_extended
  3172. abcd
  3173. /(abcd)/
  3174. abcd\=replace=${1:+xy\kz},substitute_extended
  3175. /abcd/substitute_extended,replace=>$1<
  3176. abcd
  3177. /abcd/substitute_extended,replace=>xxx${xyz}<<<
  3178. abcd
  3179. /(?J)(?:(?<A>a)|(?<A>b))/replace=<$A>
  3180. [a]
  3181. [b]
  3182. \= Expect error
  3183. (a)\=ovector=1
  3184. /(a)|(b)/replace=<$1>
  3185. \= Expect error
  3186. b
  3187. /(aa)(BB)/substitute_extended,replace=\U$1\L$2\E$1..\U$1\l$2$1
  3188. aaBB
  3189. /abcd/replace=wxyz,substitute_matched
  3190. abcd
  3191. pqrs
  3192. /abcd/g
  3193. >abcd1234abcd5678<\=replace=wxyz,substitute_matched
  3194. /^(o(\1{72}{\"{\\{00000059079}\d*){74}}){19}/I
  3195. /((p(?'K/
  3196. /((p(?'K/no_auto_capture
  3197. /abc/replace=A$3123456789Z
  3198. abc
  3199. /(?<!a{65535}a{5})x/I
  3200. /(?<!a{65535})x/I
  3201. /(?=a\K)/replace=z,allow_lookaround_bsk
  3202. BaCaD
  3203. /(?<=\K.)/g,replace=-,allow_lookaround_bsk
  3204. ab
  3205. /(?'abcdefghijklmnopqrstuvwxyzABCDEFGabcdefghijklmnopqrstuvwxyzABCDEabcdefghijklmnopqrstuvwxyzABCDEabcdefghijklmnopqrstuvwxyzABCDEFGH'toolong)/
  3206. /(?'abcdefghijklmnopqrstuvwxyzABCDEFGabcdefghijklmnopqrstuvwxyzABCDEabcdefghijklmnopqrstuvwxyzABCDEabcdefghijklmnopqrstuvwxyzABCDEFG'justright)/
  3207. # These two use zero-termination
  3208. /abcd/max_pattern_length=3
  3209. /abc/max_pattern_length=3
  3210. # These two, being hex, pass the length
  3211. /abcdefab/hex,max_pattern_length=3
  3212. /abcdef/hex,max_pattern_length=3
  3213. # Test compiled length limit
  3214. /(abcdefg){10}/max_pattern_compiled_length=100
  3215. # These patterns used to take a long time to compile
  3216. "(.*)
  3217. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3218. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3219. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
  3220. "(?<=a()
  3221. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3222. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3223. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3224. a)"xI
  3225. "(?|()|())(.*)
  3226. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3227. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3228. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
  3229. "(?|()|())(?<=a()
  3230. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3231. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3232. ((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
  3233. a)"xI
  3234. # Test the use of malloc for caching group information when there are more
  3235. # groups than fit into the on-stack workspace.
  3236. /\[()]{1024}/I,expand
  3237. # Test minlength capped at 65535
  3238. /(A{65000})\1{65000}/I
  3239. # Test group scans when numbers are not unique
  3240. /(?|()+|(a)+)/BI
  3241. /(?|(a)+|()+)/BI
  3242. /(?|()|(a))/BI
  3243. /(?|(a)|())/BI
  3244. # Test CRLF handling in empty string substitutions
  3245. /^$/gm,newline=anycrlf,replace=-
  3246. X\r\n\r\nY
  3247. /^$/gm,newline=crlf,replace=-
  3248. X\r\n\r\nY
  3249. /^$/gm,newline=any,replace=-
  3250. X\r\n\r\nY
  3251. "(*ANYCRLF)(?m)^(.*[^0-9\r\n].*|)$"g,replace=NaN
  3252. 15\r\nfoo\r\n20\r\nbar\r\nbaz\r\n\r\n20
  3253. /a[[:punct:]b]/bincode
  3254. /a[b[:punct:]]/bincode
  3255. /L(?#(|++<!(2)?/B
  3256. /L(?#(|++<!(2)?/B,no_auto_possess
  3257. /L(?#(|++<!(2)?/B,auto_callout
  3258. /L(?#(|++<!(2)?/B,no_auto_possess,auto_callout
  3259. /(A*)\E+/B,auto_callout
  3260. /()\Q\E*]/B,auto_callout
  3261. a[bc]d
  3262. /\x8a+f|;T?(*:;.'?`(\xeap ){![^()!y*''C*(?';]{1;(\x08)/B,alt_verbnames,dupnames,extended
  3263. # Tests for NULL characters in comments and verb "names" and callouts
  3264. # /A#B\x00C\x0aZ/
  3265. /41 23 42 00 43 0a 5a/Bx,hex
  3266. # /A+#B\x00C\x0a+/
  3267. /41 2b 23 42 00 43 0a 2b/Bx,hex
  3268. # /A(*:B\x00W#X\00Y\x0aC)Z/
  3269. /41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex,alt_verbnames
  3270. # /A(*:B\x00W#X\00Y\x0aC)Z/
  3271. /41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex
  3272. # /A(?C{X\x00Y})B/
  3273. /41 28 3f 43 7b 58 00 59 7d 29 42/B,hex
  3274. # /A(?#X\x00Y)B/
  3275. /41 28 3f 23 7b 00 7d 29 42/B,hex
  3276. # Tests for leading comment in extended patterns
  3277. / (?-x):?/extended
  3278. / (?-x):?/extended
  3279. /0b 28 3f 2d 78 29 3a/hex,extended
  3280. /#comment
  3281. (?-x):?/extended
  3282. /(8(*:6^\x09x\xa6l\)6!|\xd0:[^:|)\x09d\Z\d{85*m(?'(?<1!)*\W[*\xff]!!h\w]*\xbe;/alt_bsux,alt_verbnames,allow_empty_class,dollar_endonly,extended,multiline,never_utf,no_dotstar_anchor,no_start_optimize
  3283. /a|(b)c/replace=>$1<,substitute_unset_empty
  3284. cat
  3285. xbcom
  3286. /a|(b)c/
  3287. cat\=replace=>$1<
  3288. cat\=replace=>$1<,substitute_unset_empty
  3289. xbcom\=replace=>$1<,substitute_unset_empty
  3290. /a|(b)c/substitute_extended
  3291. cat\=replace=>${2:-xx}<
  3292. cat\=replace=>${2:-xx}<,substitute_unknown_unset
  3293. cat\=replace=>${X:-xx}<,substitute_unknown_unset
  3294. /a|(?'X'b)c/replace=>$X<,substitute_unset_empty
  3295. cat
  3296. xbcom
  3297. /a|(?'X'b)c/replace=>$Y<,substitute_unset_empty
  3298. cat
  3299. cat\=substitute_unknown_unset
  3300. cat\=substitute_unknown_unset,-substitute_unset_empty
  3301. /a|(b)c/replace=>$2<,substitute_unset_empty
  3302. cat
  3303. cat\=substitute_unknown_unset
  3304. cat\=substitute_unknown_unset,-substitute_unset_empty
  3305. /()()()/use_offset_limit
  3306. \=ovector=11000000000
  3307. \=callout_fail=11000000000
  3308. \=callout_fail=1:11000000000
  3309. \=callout_data=11000000000
  3310. \=callout_data=-11000000000
  3311. \=offset_limit=1100000000000000000000
  3312. \=copy=11000000000
  3313. /(*MARK:A\x00b)/mark
  3314. abc
  3315. /(*MARK:A\x00b)/mark,alt_verbnames
  3316. abc
  3317. /"(*MARK:A" 00 "b)"/mark,hex
  3318. abc
  3319. /"(*MARK:A" 00 "b)"/mark,hex,alt_verbnames
  3320. abc
  3321. /efg/hex
  3322. /eff/hex
  3323. /effg/hex
  3324. /(?J)(?'a'))(?'a')/
  3325. /(?<=((?C)0))/
  3326. 9010
  3327. \= Expect no match
  3328. abc
  3329. /aaa/
  3330. \[abc]{10000000000000000000000000000}
  3331. \[a]{3}
  3332. /\[AB]{6000000000000000000000}/expand
  3333. # Hex uses pattern length, not zero-terminated. This tests for overrunning
  3334. # the given length of a pattern.
  3335. /'(*U'/hex
  3336. /'(*'/hex
  3337. /'('/hex
  3338. //hex
  3339. # These tests are here because Perl never allows a back reference in a
  3340. # lookbehind. PCRE2 supports some limited cases.
  3341. /([ab])...(?<=\1)z/
  3342. a11az
  3343. b11bz
  3344. \= Expect no match
  3345. b11az
  3346. /(?|([ab]))...(?<=\1)z/
  3347. /([ab])(\1)...(?<=\2)z/
  3348. aa11az
  3349. /(a\2)(b\1)(?<=\2)/
  3350. /(?<A>[ab])...(?<=\k'A')z/
  3351. a11az
  3352. b11bz
  3353. \= Expect no match
  3354. b11az
  3355. /(?<A>[ab])...(?<=\k'A')(?<A>)z/dupnames
  3356. # Perl does not support \g+n
  3357. /((\g+1X)?([ab]))+/
  3358. aaXbbXa
  3359. /ab(?C1)c/auto_callout
  3360. abc
  3361. /'ab(?C1)c'/hex,auto_callout
  3362. abc
  3363. # Perl accepts these, but gives a warning. We can't warn, so give an error.
  3364. /[a-[:digit:]]+/
  3365. a-a9-a
  3366. /[A-[:digit:]]+/
  3367. A-A9-A
  3368. /[a-\d]+/
  3369. a-a9-a
  3370. /(?<RA>abc)(?(R)xyz)/B
  3371. /(?<R>abc)(?(R)xyz)/B
  3372. /(?=.*[A-Z])/I
  3373. /()(?<=(?0))/
  3374. /(?<!|!(?<!))/
  3375. /(?<!|!|!||||||(?<!)||(?<!)!|!||(?<!)!|!(?<!)!|!|!|!||||!!|<!)!|!||||!|/
  3376. /{2,2{2,2/use_length
  3377. /.>*?\g'0/use_length
  3378. /.>*?\g'0/
  3379. /{�̈́�̈́�{'{22{2{{2{'{22{{22{2{'{22{2{{2{{222{{2{'{22{2{22{2{'{22{2{{2{'{22{2{22{2{'{'{22{2{22{2{'{22{2{{2{'{22{2{22{2{'{222{2Ą̈́�̈́�{'{22{2{{2{'{22{{11{2{'{22{2{{2{{'{22{2{{2{'{22{{22{1{'{22{2{{2{{222{{2{'{22{2{22{2{'{/auto_callout
  3380. //
  3381. \=get=i00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  3382. \=get=i2345678901234567890123456789012,get=i1245678901234567890123456789012
  3383. "(?(?C))"
  3384. /(?(?(?(?(?(?))))))/
  3385. /(?<=(?1))((?s))/anchored
  3386. /(*:ab)*/
  3387. %(*:(:(svvvvvvvvvv:]*[ Z!*;[]*[^[]*!^[+.+{{2,7}' _\\\\\\\\\\\\\)?.:.. *w////\\\Q\\\\\\\\\\\\\\\T\\\\\+/?/////'+\\\EEE?/////'+/*+/[^K]?]//(w)%never_backslash_c,alt_verbnames,auto_callout
  3388. /./newline=crlf
  3389. \=ph
  3390. /(\x0e00\000000\xc)/replace=\P,substitute_extended
  3391. \x0e00\000000\xc
  3392. //replace=0
  3393. \=offset=7
  3394. /(?<=\G.)/g,replace=+
  3395. abc
  3396. ".+\QX\E+"B,no_auto_possess
  3397. ".+\QX\E+"B,auto_callout,no_auto_possess
  3398. # This one is here because Perl gives an 'unmatched )' error which goes away
  3399. # if one of the \) sequences is removed - which is weird. PCRE finds it too
  3400. # complicated to find a minimum matching length.
  3401. "()X|((((((((()))))))((((())))))\2())((((((\2\2)))\2)(\22((((\2\2)2))\2)))(2\ZZZ)+:)Z^|91ZiZZnter(ZZ |91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z+:)Z|91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z((Z*(\2(Z\':))\0)i|||||||||||||||loZ\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0nte!rnal errpr\2\\21r(2\ZZZ)+:)Z!|91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0(2\ZZZ)+:)Z^|91ZiZZnter(ZZ |91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0(2\ZZZ)+:)Z^)))int \)\0(2\ZZZ)+:)Z^|91ZiZZnter(ZZernZal ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \))\ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)))\2))))((((((\2\2))))))"I
  3402. # This checks that new code for handling groups that may match an empty string
  3403. # works on a very large number of alternatives. This pattern used to provoke a
  3404. # complaint that it was too complicated.
  3405. /(?:\[A|B|C|D|E|F|G|H|I|J|]{200}Z)/expand
  3406. # This one used to compile rubbish instead of a compile error, and then
  3407. # behave unpredictably at match time.
  3408. /.+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X/
  3409. .+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X
  3410. /[:[:alnum:]-[[a:lnum:]+/
  3411. /((?(?C'')\QX\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
  3412. /((?(?C'')\Q\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
  3413. /abcd/auto_callout
  3414. abcd\=callout_error=255:2
  3415. /()(\g+65534)/
  3416. /()(\g+65533)/
  3417. /�\x00\x00\x00�(\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\x00k\d+\x00‎\x00\x00\x00\x00\x00\2*\x00\x00\1*.){36}int^\x00\x00��\x00�(\1{50779}?)J\w2/I
  3418. /(a)(b)\2\1\1\1\1/I
  3419. /(?<a>a)(?<b>b)\g{b}\g{a}\g{a}\g{a}\g{a}(?<a>xx)(?<b>zz)/I,dupnames
  3420. //
  3421. \=ovector=7777777777
  3422. # This is here because Perl matches, even though a COMMIT is encountered
  3423. # outside of the recursion.
  3424. /(?1)(A(*COMMIT)|B)D/
  3425. BAXBAD
  3426. "(?1){2}(a)"B
  3427. "(?1){2,4}(a)"B
  3428. # This test differs from Perl for the first subject. Perl ends up with
  3429. # $1 set to 'B'; PCRE2 has it unset (which I think is right).
  3430. /^(?:
  3431. (?:A| (?:B|B(*ACCEPT)) (?<=(.)) D)
  3432. (Z)
  3433. )+$/x
  3434. AZB
  3435. AZBDZ
  3436. # The first of these, when run by Perl, gives the mark 'aa', which is wrong.
  3437. '(?>a(*:aa))b|ac' mark
  3438. ac
  3439. '(?:a(*:aa))b|ac' mark
  3440. ac
  3441. /(R?){65}/
  3442. (R?){65}
  3443. /\[(a)]{60}/expand
  3444. aaaa
  3445. /(?<!\1((?U)1((?U))))(*F)/never_backslash_c,alt_bsux,anchored,extended
  3446. /\g{3/
  3447. /(a(?C1)(b)(c)d)+/
  3448. abcdabcd\=callout_capture
  3449. # Perl matches this one, but PCRE does not because (*ACCEPT) clears out any
  3450. # pending backtracks in the recursion.
  3451. /^ (?(DEFINE) (..(*ACCEPT)|...) ) (?1)$/x
  3452. \= Expect no match
  3453. abc
  3454. # Perl gives no match for this one
  3455. /(a(*MARK:m)(*ACCEPT)){0}(?1)/mark
  3456. abc
  3457. /abc/endanchored
  3458. xyzabc
  3459. \= Expect no match
  3460. xyzabcdef
  3461. \= Expect error
  3462. xyzabc\=ph
  3463. /abc/
  3464. xyzabc\=endanchored
  3465. \= Expect no match
  3466. xyzabcdef\=endanchored
  3467. \= Expect error
  3468. xyzabc\=ps,endanchored
  3469. /abc(*ACCEPT)d/endanchored
  3470. xyzabc
  3471. \= Expect no match
  3472. xyzabcdef
  3473. /abc|bcd/endanchored
  3474. xyzabcd
  3475. \= Expect no match
  3476. xyzabcdef
  3477. /a(*ACCEPT)x|aa/endanchored
  3478. aaa
  3479. # Check auto-anchoring when there is a group that is never obeyed at
  3480. # the start of a branch.
  3481. /(?(DEFINE)(a))^bc/I
  3482. /(a){0}.*bc/sI
  3483. # This should be anchored, as the condition is always false and there is
  3484. # no alternative branch.
  3485. /(?(VERSION>=999)yes)^bc/I
  3486. # This should not be anchored.
  3487. /(?(VERSION>=999)yes|no)^bc/I
  3488. /(*LIMIT_HEAP=0)xxx/I
  3489. /\d{0,3}(*:abc)(?C1)xxx/callout_info
  3490. # ----------------------------------------------------------------------
  3491. # These are a whole pile of tests that touch lines of code that are not
  3492. # used by any other tests (at least when these were created).
  3493. /^a+?x/i,no_start_optimize,no_auto_possess
  3494. \= Expect no match
  3495. aaa
  3496. /^[^a]{3,}?x/i,no_start_optimize,no_auto_possess
  3497. \= Expect no match
  3498. bbb
  3499. cc
  3500. /^X\S/no_start_optimize,no_auto_possess
  3501. \= Expect no match
  3502. X
  3503. /^X\W/no_start_optimize,no_auto_possess
  3504. \= Expect no match
  3505. X
  3506. /^X\H/no_start_optimize,no_auto_possess
  3507. \= Expect no match
  3508. X
  3509. /^X\h/no_start_optimize,no_auto_possess
  3510. \= Expect no match
  3511. X
  3512. /^X\V/no_start_optimize,no_auto_possess
  3513. \= Expect no match
  3514. X
  3515. /^X\v/no_start_optimize,no_auto_possess
  3516. \= Expect no match
  3517. X
  3518. /^X\h/no_start_optimize,no_auto_possess
  3519. \= Expect no match
  3520. XY
  3521. /^X\V/no_start_optimize,no_auto_possess
  3522. \= Expect no match
  3523. X\n
  3524. /^X\v/no_start_optimize,no_auto_possess
  3525. \= Expect no match
  3526. XX
  3527. /^X.+?/s,no_start_optimize,no_auto_possess
  3528. \= Expect no match
  3529. X
  3530. /^X\R+?/no_start_optimize,no_auto_possess
  3531. \= Expect no match
  3532. XX
  3533. /^X\H+?/no_start_optimize,no_auto_possess
  3534. \= Expect no match
  3535. X
  3536. /^X\h+?/no_start_optimize,no_auto_possess
  3537. \= Expect no match
  3538. X
  3539. /^X\V+?/no_start_optimize,no_auto_possess
  3540. \= Expect no match
  3541. X
  3542. X\n
  3543. /^X\D+?/no_start_optimize,no_auto_possess
  3544. \= Expect no match
  3545. X
  3546. X9
  3547. /^X\S+?/no_start_optimize,no_auto_possess
  3548. \= Expect no match
  3549. X
  3550. X\n
  3551. /^X\W+?/no_start_optimize,no_auto_possess
  3552. \= Expect no match
  3553. X
  3554. XX
  3555. /^X.+?Z/no_start_optimize,no_auto_possess
  3556. \= Expect no match
  3557. XY\n
  3558. /(*CRLF)^X.+?Z/no_start_optimize,no_auto_possess
  3559. \= Expect no match
  3560. XY\r\=ps
  3561. /^X\R+?Z/no_start_optimize,no_auto_possess
  3562. \= Expect no match
  3563. X\nX
  3564. X\n\r\n
  3565. X\n\rY
  3566. X\n\nY
  3567. X\n\x{0c}Y
  3568. /(*BSR_ANYCRLF)^X\R+?Z/no_start_optimize,no_auto_possess
  3569. \= Expect no match
  3570. X\nX
  3571. X\n\r\n
  3572. X\n\rY
  3573. X\n\nY
  3574. X\n\x{0c}Y
  3575. /^X\H+?Z/no_start_optimize,no_auto_possess
  3576. \= Expect no match
  3577. XY\t
  3578. XYY
  3579. /^X\h+?Z/no_start_optimize,no_auto_possess
  3580. \= Expect no match
  3581. X\t\t
  3582. X\tY
  3583. /^X\V+?Z/no_start_optimize,no_auto_possess
  3584. \= Expect no match
  3585. XY\n
  3586. XYY
  3587. /^X\v+?Z/no_start_optimize,no_auto_possess
  3588. \= Expect no match
  3589. X\n\n
  3590. X\nY
  3591. /^X\D+?Z/no_start_optimize,no_auto_possess
  3592. \= Expect no match
  3593. XY9
  3594. XYY
  3595. /^X\d+?Z/no_start_optimize,no_auto_possess
  3596. \= Expect no match
  3597. X99
  3598. X9Y
  3599. /^X\S+?Z/no_start_optimize,no_auto_possess
  3600. \= Expect no match
  3601. XY\n
  3602. XYY
  3603. /^X\s+?Z/no_start_optimize,no_auto_possess
  3604. \= Expect no match
  3605. X\n\n
  3606. X\nY
  3607. /^X\W+?Z/no_start_optimize,no_auto_possess
  3608. \= Expect no match
  3609. X.A
  3610. X++
  3611. /^X\w+?Z/no_start_optimize,no_auto_possess
  3612. \= Expect no match
  3613. Xa.
  3614. Xaa
  3615. /^X.{1,3}Z/s,no_start_optimize,no_auto_possess
  3616. \= Expect no match
  3617. Xa.bd
  3618. /^X\h+Z/no_start_optimize,no_auto_possess
  3619. \= Expect no match
  3620. X\t\t
  3621. X\tY
  3622. /^X\V+Z/no_start_optimize,no_auto_possess
  3623. \= Expect no match
  3624. XY\n
  3625. XYY
  3626. /^(X(*THEN)Y|AB){0}(?1)/
  3627. ABX
  3628. \= Expect no match
  3629. XAB
  3630. /^(?!A(?C1)B)C/
  3631. ABC\=callout_error=1,no_jit
  3632. /^(?!A(?C1)B)C/no_start_optimize
  3633. ABC\=callout_error=1
  3634. /^(?(?!A(?C1)B)C)/
  3635. ABC\=callout_error=1
  3636. # ----------------------------------------------------------------------
  3637. /[a b c]/BxxI
  3638. /[a b c]/BxxxI
  3639. /[a b c]/B,extended_more
  3640. /[ a b c ]/B,extended_more
  3641. /[a b](?xx: [ 12 ] (?-xx:[ 34 ]) )y z/B
  3642. # Unsetting /x also unsets /xx
  3643. /[a b](?xx: [ 12 ] (?-x:[ 34 ]) )y z/B
  3644. /(a)(?-n:(b))(c)/nB
  3645. # ----------------------------------------------------------------------
  3646. # These test the dangerous PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL option.
  3647. /\j\x{z}\o{82}\L\uabcd\u\U\g{\g/B,\bad_escape_is_literal
  3648. /\N{\c/IB,bad_escape_is_literal
  3649. /[\j\x{z}\o\gAb\g]/B,bad_escape_is_literal
  3650. /[Q-\N]/B,bad_escape_is_literal
  3651. /[\s-_]/bad_escape_is_literal
  3652. /[_-\s]/bad_escape_is_literal
  3653. /[\B\R\X]/B
  3654. /[\B\R\X]/B,bad_escape_is_literal
  3655. /[A-\BP-\RV-\X]/B
  3656. /[A-\BP-\RV-\X]/B,bad_escape_is_literal
  3657. # ----------------------------------------------------------------------
  3658. /a\b(c/literal
  3659. a\\b(c
  3660. /a\b(c/literal,caseless
  3661. a\\b(c
  3662. a\\B(c
  3663. /a\b(c/literal,firstline
  3664. XYYa\\b(c
  3665. \= Expect no match
  3666. X\na\\b(c
  3667. /a\b?c/literal,use_offset_limit
  3668. XXXXa\\b?c\=offset_limit=4
  3669. \= Expect no match
  3670. XXXXa\\b?c\=offset_limit=3
  3671. /a\b(c/literal,anchored,endanchored
  3672. a\\b(c
  3673. \= Expect no match
  3674. Xa\\b(c
  3675. a\\b(cX
  3676. Xa\\b(cX
  3677. //literal,extended
  3678. /a\b(c/literal,auto_callout,no_start_optimize
  3679. XXXXa\\b(c
  3680. /a\b(c/literal,auto_callout
  3681. XXXXa\\b(c
  3682. /(*CR)abc/literal
  3683. (*CR)abc
  3684. /cat|dog/I,match_word
  3685. the cat sat
  3686. \= Expect no match
  3687. caterpillar
  3688. snowcat
  3689. syndicate
  3690. /(cat)|dog/I,match_line,literal
  3691. (cat)|dog
  3692. \= Expect no match
  3693. the cat sat
  3694. caterpillar
  3695. snowcat
  3696. syndicate
  3697. /a whole line/match_line,multiline
  3698. Rhubarb \na whole line\n custard
  3699. \= Expect no match
  3700. Not a whole line
  3701. # Perl gets this wrong, failing to capture 'b' in group 1.
  3702. /^(b+|a){1,2}?bc/
  3703. bbc
  3704. # And again here, for the "babc" subject string.
  3705. /^(b*|ba){1,2}?bc/
  3706. babc
  3707. bbabc
  3708. bababc
  3709. \= Expect no match
  3710. bababbc
  3711. babababc
  3712. /[[:digit:]-a]/
  3713. /[[:digit:]-[:print:]]/
  3714. /[\d-a]/
  3715. /[\H-z]/
  3716. /[\d-[:print:]]/
  3717. # Perl gets the second of these wrong, giving no match.
  3718. "(?<=(a))\1?b"I
  3719. ab
  3720. aaab
  3721. "(?=(a))\1?b"I
  3722. ab
  3723. aaab
  3724. # JIT does not support callout_extra
  3725. /(*NO_JIT)(a+)b/auto_callout,no_start_optimize,no_auto_possess
  3726. \= Expect no match
  3727. aac\=callout_extra
  3728. /(*NO_JIT)a+(?C'XXX')b/no_start_optimize,no_auto_possess
  3729. \= Expect no match
  3730. aac\=callout_extra
  3731. /\n/firstline
  3732. xyz\nabc
  3733. /\nabc/firstline
  3734. xyz\nabc
  3735. /\x{0a}abc/firstline,newline=crlf
  3736. \= Expect no match
  3737. xyz\r\nabc
  3738. /[abc]/firstline
  3739. \= Expect no match
  3740. \na
  3741. # These tests are matched in test 1 as they are Perl compatible. Here we are
  3742. # looking at what does and does not get auto-possessified.
  3743. /(?(DEFINE)(?<optional_a>a?))^(?&optional_a)a$/B
  3744. /(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/B
  3745. /^(a?)b(?1)a/B
  3746. /^(a?)+b(?1)a/B
  3747. /^(a?)++b(?1)a/B
  3748. /^(a?)+b/B
  3749. /(?=a+)a(a+)++b/B
  3750. /(?<=(?=.){4,5}x)/B
  3751. # Perl behaves differently with these when optimization is turned off
  3752. /a(*PRUNE:X)bc|qq/mark,no_start_optimize
  3753. \= Expect no match
  3754. axy
  3755. /a(*THEN:X)bc|qq/mark,no_start_optimize
  3756. \= Expect no match
  3757. axy
  3758. /(?^x-i)AB/
  3759. /(?^-i)AB/
  3760. /(?x-i-i)/
  3761. /(?(?=^))b/I
  3762. abc
  3763. /(?(?=^)|)b/I
  3764. abc
  3765. /(?(?=^)|^)b/I
  3766. bbc
  3767. \= Expect no match
  3768. abc
  3769. /(?(1)^|^())/I
  3770. /(?(1)^())b/I
  3771. /(?(1)^())+b/I,aftertext
  3772. abc
  3773. /(?(1)^()|^)+b/I,aftertext
  3774. bbc
  3775. \= Expect no match
  3776. abc
  3777. /(?(1)^()|^)*b/I,aftertext
  3778. bbc
  3779. abc
  3780. xbc
  3781. /(?(1)^())+b/I,aftertext
  3782. abc
  3783. /(?(1)^a()|^a)+b/I,aftertext
  3784. abc
  3785. \= Expect no match
  3786. bbc
  3787. /(?(1)^|^(a))+b/I,aftertext
  3788. abc
  3789. \= Expect no match
  3790. bbc
  3791. /(?(1)^a()|^a)*b/I,aftertext
  3792. abc
  3793. bbc
  3794. xbc
  3795. /a(b)c|xyz/g,allvector,replace=<$0>
  3796. abcdefabcpqr\=ovector=4
  3797. abxyz\=ovector=4
  3798. abcdefxyz\=ovector=4
  3799. /a(b)c|xyz/allvector
  3800. abcdef\=ovector=4
  3801. abxyz\=ovector=4
  3802. /a(b)c|xyz/g,replace=<$0>,substitute_callout
  3803. abcdefabcpqr
  3804. abxyzpqrabcxyz
  3805. 12abc34xyz99abc55\=substitute_stop=2
  3806. 12abc34xyz99abc55\=substitute_skip=1
  3807. 12abc34xyz99abc55\=substitute_skip=2
  3808. /a(b)c|xyz/g,replace=<$0>
  3809. abcdefabcpqr
  3810. abxyzpqrabcxyz
  3811. 12abc34xyz\=substitute_stop=2
  3812. 12abc34xyz\=substitute_skip=1
  3813. /a(b)c|xyz/replace=<$0>
  3814. abcdefabcpqr
  3815. 12abc34xyz\=substitute_skip=1
  3816. 12abc34xyz\=substitute_stop=1
  3817. /abc\rdef/
  3818. abc\ndef
  3819. /abc\rdef\x{0d}xyz/escaped_cr_is_lf
  3820. abc\ndef\rxyz
  3821. \= Expect no match
  3822. abc\ndef\nxyz
  3823. /(?(*ACCEPT)xxx)/
  3824. /(?(*atomic:xx)xxx)/
  3825. /(?(*script_run:xxx)zzz)/
  3826. /foobar/
  3827. the foobar thing\=copy_matched_subject
  3828. the foobar thing\=copy_matched_subject,zero_terminate
  3829. /foobar/g
  3830. the foobar thing foobar again\=copy_matched_subject
  3831. /(*:XX)^abc/I
  3832. /(*COMMIT:XX)^abc/I
  3833. /(*ACCEPT:XX)^abc/I
  3834. /abc/replace=xyz
  3835. abc\=null_context
  3836. /abc/replace=xyz,substitute_callout
  3837. abc
  3838. \= Expect error message
  3839. abc\=null_context
  3840. /\[()]{65535}()/expand
  3841. /\[()]{65535}(?<A>)/expand
  3842. /a(?:(*ACCEPT))??bc/
  3843. abc
  3844. axy
  3845. /a(*ACCEPT)??bc/
  3846. abc
  3847. axy
  3848. /a(*ACCEPT:XX)??bc/mark
  3849. abc
  3850. axy
  3851. /(*:\)?/
  3852. /(*:\Q \E){5}/alt_verbnames
  3853. /(?=abc)/I
  3854. /(?|(X)|(XY))\1abc/I
  3855. /(?|(a)|(bcde))(c)\2/I
  3856. /(?|(a)|(bcde))(c)\1/I
  3857. /(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'B'(?'A')/I,dupnames
  3858. /(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'A'(?'A')/I,dupnames
  3859. /((a|)+)+Z/I
  3860. /((?=a))[abcd]/I
  3861. /A(?:(*ACCEPT))?B/info
  3862. /(A(*ACCEPT)??B)C/
  3863. ABC
  3864. AXY
  3865. /(?<=(?<=a)b)c.*/I
  3866. abc\=ph
  3867. \= Expect no match
  3868. xbc\=ph
  3869. /(?<=ab)c.*/I
  3870. abc\=ph
  3871. \= Expect no match
  3872. xbc\=ph
  3873. /(?<=a(?<=a|a)c)/I
  3874. /(?<=a(?<=a|ba)c)/I
  3875. /(?<=(?<=a)b)(?<!abcd)/I
  3876. /(?<=(?<=a)b)(?<!abcd)(?<=(?<=a)bcde)/I
  3877. # Addition overflow
  3878. /( {32742} {42})(?<!\1{65481})/
  3879. # Multiplication overflow
  3880. /(X{65535})(?<=\1{32770})/
  3881. # ---- Non-atomic assertion tests ----
  3882. # Expect error: not allowed as a condition
  3883. /(?(*napla:xx)bc)/
  3884. /\A(*pla:.*\b(\w++))(?>.*?\b\1\b){3}/
  3885. word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
  3886. /\A(*napla:.*\b(\w++))(?>.*?\b\1\b){3}/
  3887. word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
  3888. /\A(?*.*\b(\w++))(?>.*?\b\1\b){3}/
  3889. word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
  3890. /(*plb:(.)..|(.)...)(\1|\2)/
  3891. abcdb\=offset=4
  3892. abcda\=offset=4
  3893. /(*naplb:(.)..|(.)...)(\1|\2)/
  3894. abcdb\=offset=4
  3895. abcda\=offset=4
  3896. /(?<*(.)..|(.)...)(\1|\2)/
  3897. abcdb\=offset=4
  3898. abcda\=offset=4
  3899. /(*non_atomic_positive_lookahead:ab)/B
  3900. /(*non_atomic_positive_lookbehind:ab)/B
  3901. /(*pla:ab+)/B
  3902. /(*napla:ab+)/B
  3903. /(*napla:)+/
  3904. /(*naplb:)+/
  3905. /(*napla:^x|^y)/I
  3906. /(*napla:abc|abd)/I
  3907. /(*napla:a|(.)(*ACCEPT)zz)\1../
  3908. abcd
  3909. /(*napla:a(*ACCEPT)zz|(.))\1../
  3910. abcd
  3911. /(*napla:a|(*COMMIT)(.))\1\1/
  3912. aabc
  3913. \= Expect no match
  3914. abbc
  3915. /(*napla:a|(.))\1\1/
  3916. aabc
  3917. abbc
  3918. /(*naplb:ab?c|PQ).../g
  3919. abcdefgacxyzPQR123
  3920. # ----
  3921. # Expect error (recursion => not fixed length)
  3922. /(\2)((?=(?<=\1)))/
  3923. /c*+(?<=[bc])/
  3924. abc\=ph
  3925. ab\=ph
  3926. abc\=ps
  3927. ab\=ps
  3928. /c++(?<=[bc])/
  3929. abc\=ph
  3930. ab\=ph
  3931. /(?<=(?=.(?<=x)))/
  3932. abx
  3933. ab\=ph
  3934. bxyz
  3935. xyz
  3936. /\z/
  3937. abc\=ph
  3938. abc\=ps
  3939. /\Z/
  3940. abc\=ph
  3941. abc\=ps
  3942. abc\n\=ph
  3943. abc\n\=ps
  3944. /(?![ab]).*/
  3945. ab\=ph
  3946. /c*+/
  3947. ab\=ph,offset=2
  3948. /\A\s*(a|(?:[^`]{28500}){4})/I
  3949. a
  3950. /\A\s*((?:[^`]{28500}){4})/I
  3951. /\A\s*((?:[^`]{28500}){4}|a)/I
  3952. a
  3953. /(?<A>a)(?(<A>)b)((?<=b).*)/B
  3954. /(?(1)b)((?<=b).*)/B
  3955. /(?(R1)b)((?<=b).*)/B
  3956. /(?(DEFINE)b)((?<=b).*)/B
  3957. /(?(VERSION=10.3)b)((?<=b).*)/B
  3958. /[aA]b[cC]/IB
  3959. /[cc]abcd/I
  3960. /[Cc]abcd/I
  3961. /[c]abcd/I
  3962. /(?:c|C)abcd/I
  3963. /(a)?a/I
  3964. manm
  3965. /^(?|(\*)(*napla:\S*_(\2?+.+))|(\w)(?=\S*_(\2?+\1)))+_\2$/
  3966. *abc_12345abc
  3967. /^(?|(\*)(*napla:\S*_(\3?+.+))|(\w)(?=\S*_((\2?+\1))))+_\2$/
  3968. *abc_12345abc
  3969. /^((\1+)(?C)|\d)+133X$/
  3970. 111133X\=callout_capture
  3971. /abc/replace=xyz,substitute_replacement_only
  3972. 123abc456
  3973. /a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z,substitute_replacement_only
  3974. "abcde-abcde-"
  3975. /a(b)c|xyz/g,replace=<$0>,substitute_callout,substitute_replacement_only
  3976. abcdefabcpqr
  3977. abxyzpqrabcxyz
  3978. 12abc34xyz99abc55\=substitute_stop=2
  3979. 12abc34xyz99abc55\=substitute_skip=1
  3980. 12abc34xyz99abc55\=substitute_skip=2
  3981. /a(..)d/replace=>$1<,substitute_matched
  3982. xyzabcdxyzabcdxyz
  3983. xyzabcdxyzabcdxyz\=ovector=2
  3984. \= Expect error
  3985. xyzabcdxyzabcdxyz\=ovector=1
  3986. /a(..)d/g,replace=>$1<,substitute_matched
  3987. xyzabcdxyzabcdxyz
  3988. xyzabcdxyzabcdxyz\=ovector=2
  3989. \= Expect error
  3990. xyzabcdxyzabcdxyz\=ovector=1
  3991. xyzabcdxyzabcdxyz\=ovector=1,substitute_unset_empty
  3992. /55|a(..)d/g,replace=>$1<,substitute_matched
  3993. xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
  3994. \= Expect error
  3995. xyz55abcdxyzabcdxyz\=ovector=2
  3996. /55|a(..)d/replace=>$1<,substitute_matched
  3997. xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
  3998. /55|a(..)d/replace=>$1<
  3999. xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
  4000. /55|a(..)d/g,replace=>$1<
  4001. xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
  4002. /abc/replace=,caseless
  4003. XabcY
  4004. XABCY
  4005. /abc/replace=[4],caseless
  4006. XabcY
  4007. XABCY
  4008. /abc/replace=*,caseless
  4009. XabcY
  4010. XABCY
  4011. XabcY\=replace=
  4012. # Expect non-fixed-length error
  4013. "(?<=X(?(DEFINE)(.*))(?1))."
  4014. /\sxxx\s/tables=1
  4015. \= Expect no match
  4016. AB\x{85}xxx\x{a0}XYZ
  4017. /\sxxx\s/tables=2
  4018. AB\x{85}xxx\x{a0}XYZ
  4019. /^\w+/tables=2
  4020. École
  4021. /^\w+/tables=3
  4022. École
  4023. #loadtables ./testbtables
  4024. /^\w+/tables=3
  4025. École
  4026. /"(*MARK:>" 00 "<).."/hex,mark,no_start_optimize
  4027. AB
  4028. A\=ph
  4029. \= Expect no match
  4030. A
  4031. /"(*MARK:>" 00 "<).(?C1)."/hex,mark,no_start_optimize
  4032. AB
  4033. /(?(VERSION=0.0/
  4034. # Perl has made \K in lookarounds an error. PCRE2 now rejects as well, unless
  4035. # explicitly authorized.
  4036. /(?=a\Kb)ab/
  4037. /(?=a\Kb)ab/allow_lookaround_bsk
  4038. ab
  4039. /(?!a\Kb)ac/
  4040. /(?!a\Kb)ac/allow_lookaround_bsk
  4041. ac
  4042. /^abc(?<=b\Kc)d/
  4043. /^abc(?<=b\Kc)d/allow_lookaround_bsk
  4044. abcd
  4045. /^abc(?<!b\Kq)d/
  4046. /^abc(?<!b\Kq)d/,allow_lookaround_bsk
  4047. abcd
  4048. # ---------
  4049. # Tests for zero-length NULL to be treated as an empty string.
  4050. //
  4051. \=null_subject
  4052. \= Expect error
  4053. abc\=null_subject
  4054. //replace=[20]
  4055. abc\=null_replacement
  4056. \=null_subject
  4057. \=null_replacement
  4058. /X*/g,replace=xy
  4059. \= Expect error
  4060. >X<\=null_replacement
  4061. /X+/replace=[20]
  4062. >XX<\=null_replacement
  4063. # ---------
  4064. /[Aa]{2}/BI
  4065. aabcd
  4066. /A{2}/iBI
  4067. aabcd
  4068. /[Aa]{2,3}/BI
  4069. aabcd
  4070. --
  4071. \[X]{-10}
  4072. # Check imposition of maximum by match_data_create().
  4073. /abcd/
  4074. abcd\=ovector=65536
  4075. # Use recurse to test \K and Mark in atomic scope.
  4076. /(?>this line\s*((?R)|)\K)/
  4077. this line this line this line
  4078. /(?>this line\s*((?R)|)(*MARK:A))/
  4079. this line this line this line
  4080. # Check use of NULL pattern with zero length.
  4081. //null_pattern,use_length
  4082. abc
  4083. //null_pattern
  4084. /bad null pattern/null_pattern,use_length
  4085. /bad null pattern/null_pattern
  4086. # -------- Variable length lookbehinds --------
  4087. /12345(?<=\d{1,256})X/
  4088. /(?<=(\d{1,256}))X/max_varlookbehind=256
  4089. 12345XYZ
  4090. /12345(?<=a?bc)X/max_varlookbehind=0
  4091. /12345(?<=abc)X/max_varlookbehind=0
  4092. /(?<!( {65054}){9,44965})/
  4093. /(?(?<!|(|a)))/
  4094. aaaa\=get=0
  4095. /(?(?<!|a?))/
  4096. aaaa\=get=0
  4097. # --------
  4098. /(?<=(()()()()()()()()()()()()()(()()()()(())()()()()(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(())()()()()(()()()()()()(()()()()()()()()()()()()()()()()()()()()()(())()()()()(()()()()()()()()()()()()()(()()()()()()()()()()()()()(()())))))))))/
  4099. /(?<!( {65054}){0,44965})/auto_callout
  4100. /A+{,3}/
  4101. /(\g{+1}Z|(A))+/
  4102. BAAZCD
  4103. ZAAAZAZAZAACD
  4104. # This doesn't work in Perl (though I think it used to)
  4105. /^(?=.*(?=(([A-Z]).*(?(1)\1)))(?!.+\2)){26}/i
  4106. The quick brown fox jumps over the lazy dog.
  4107. Jackdaws love my big sphinx of quartz.
  4108. Pack my box with five dozen liquor jugs.
  4109. \= Expect no match
  4110. The quick brown fox jumps over the lazy cat.
  4111. Hackdaws love my big sphinx of quartz.
  4112. Pack my fox with five dozen liquor jugs.
  4113. # These are different to Perl because of the different capturing in repeating
  4114. # groups.
  4115. /((foo)|(bar))*/
  4116. foobar
  4117. /(?:(f)(o)(o)|(b)(a)(r))*/
  4118. foobar
  4119. /((Z)+|A)*/
  4120. ZABCDEFG
  4121. /(?:(?P=same)?(?:(?P<same>a)|(?P<same>b))(?P=same))+/g,dupnames
  4122. bbbaaabaabb
  4123. # --------
  4124. /
  4125. /anchored, firstline
  4126. \x0a
  4127. /
  4128. /anchored,firstline,no_start_optimize
  4129. \x0a
  4130. /
  4131. /firstline
  4132. \x0a
  4133. abc\x0adef
  4134. # This test is currently broken in the interpreter
  4135. # /|a(?0)/endanchored
  4136. # aaaa
  4137. /A +/extended
  4138. /(*ACCEPT)+/B,auto_callout
  4139. /a\z/
  4140. a
  4141. a\=noteol
  4142. # This matches a character that only exists once in the subject, sort of like a
  4143. # hypothetical "(.)(?<!\1.+)(?!.*\1)". That has unlimited variable length
  4144. # lookbehind, so is invalid. This pattern doesn't work in Perl 5.38.0.
  4145. /\G(?:(?=(\1.|)(.))){1,13}?(?!.*\2.*\2)\1\K\2/g
  4146. aaabcccdeee
  4147. /|(?0)./endanchored
  4148. abcd
  4149. /|a(?0)/endanchored
  4150. aaaa
  4151. /(?:|(?0).)(?(R)|\z)/
  4152. abcd
  4153. /a?(?=b(*COMMIT)c|)d/I
  4154. bd
  4155. /(?=b(*COMMIT)c|)d/I
  4156. bd
  4157. /a?(?=b(*COMMIT)c|)d/I,no_start_optimize
  4158. bd
  4159. /(?=b(*COMMIT)c|)d/I,no_start_optimize
  4160. bd
  4161. /a?(?=bc|)d/I,auto_callout
  4162. bd
  4163. /a?(?=bc|)\bd/I
  4164. bd
  4165. /(?0)/
  4166. abc\=disable_recurseloop_check,match_limit=100
  4167. /(a(?1)z||(?1)++)$/
  4168. abcd\=disable_recurseloop_check
  4169. /(((?<=123?456456|ABC)))(?<=\2)../
  4170. ABCDEFG
  4171. 12345645678910
  4172. # This test is crashing Perl 5.38.2.
  4173. /[^\S\W]{6}/
  4174. .abc def..
  4175. # End of testinput2