xref: /PHP-7.4/ext/pcre/tests/study.phpt (revision c93dc5d8)
1--TEST--
2Study regex
3--FILE--
4<?php
5
6var_dump(preg_match('/(?:(?:(?:(?:(?:(.))))))/  S', 'aeiou', $dump));
7var_dump($dump[1]);
8var_dump(preg_match('/(?:(?:(?:(?:(?:(.))))))/', 'aeiou', $dump));
9var_dump($dump[1]);
10
11var_dump(preg_match('/(?>..)((?:(?>.)|.|.|.|u))/S', 'aeiou', $dump));
12var_dump($dump[1]);
13
14// try to trigger usual "match known text" optimization
15var_dump(preg_match('/^aeiou$/S', 'aeiou', $dump));
16var_dump($dump[0]);
17var_dump(preg_match('/aeiou/S', 'aeiou', $dump));
18var_dump($dump[0]);
19
20?>
21--EXPECT--
22int(1)
23string(1) "a"
24int(1)
25string(1) "a"
26int(1)
27string(1) "i"
28int(1)
29string(5) "aeiou"
30int(1)
31string(5) "aeiou"
32