<?php $tests = [ 'foo', 'fooBar', 'foo123', '123Foo', 'fooBar123', 'foo123Bar', '123FooBar', ]; var_export( preg_replace( '/(?:\d++|[A-Za-z]?[a-z]++)\K(?!$)/', '-', $tests ) );
You have javascript disabled. You will not be able to edit any code.