I'm relying on the Low Regex plugin to convert section handles from camelCase to lower-dash-case to use them in URLs, like so:
{section.handle|regex('/(^|[a-z])([A-Z])/e', 'strtolower(strlen("\\1") ? "\\1-\\2" : "\\2")',(section.handle))}
…and further, to convert the segment of the URL that contains the dash-separated section name to camel case, so I can work with it in my templates, like so:
{% set sectionHandle = craft.request.getFirstSegment() %}
{% set sectionHandleCc = sectionHandle | regex('/-([a-z])/e', 'strtoupper(strlen("\\1") ? "\\1\\2" : "\\2")',(sectionHandle)) %}
{% set section = craft.sections.getSectionByHandle(sectionHandleCc) %}
Now, OS X 10.10 Yosemite ships with PHP version 5.5.14 pre-installed and as of 5.5.0 the e-modifier for regex patterns is deprecated, so on my local machine I get this error and the site breaks:
I got in touch with the plugin author and he suggested removing the e-modifier, which seemed to work within the templates, but when I removed the modifier in the sections entry URL format the CP wasn't able to re-save my entries and I couldn't save new entries either.
The question that remains is: Is there a workaround using a different regex pattern or – and that would be my preferred scenario – is there an approach I didn't think of that allows me to omit the plugin dependency completely? I guess one option would be to keep the section handles all lowercase, but I'd like to have them dash-separated in the URLs.