3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input_lines = [ "abc-def/something/else/ [incl. slash if there is not character before it]", "abc-def-2019/something/else/", "abc-def-2019-2020/something/else/", "abc-def-125-2019/something/else/", "aaa-20199-2019/", "aaa", "aaa/", "aaa2019", "aaa2019test/", "aaa201aaa2019aaa2019/" ]; $pattern = '~^(?=[a-z\d-]*/)[a-zA-Z013-9-]+(?>2(?!0(?:19|20)(?!\d))|[a-zA-Z013-9-]+)*/?~'; foreach ($input_lines as $input_line) { echo preg_replace($pattern, '', $input_line) . PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
something/else/ [incl. slash if there is not character before it] 2019/something/else/ 2019-2020/something/else/ 2019/something/else/ 2019/ aaa aaa2019 2019test/ 2019aaa2019/

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
27.64 ms | 405 KiB | 5 Q