I have several snippets for creating form elements in sublime text 2 for blade.
In order to make the snippets more sufficient, I would like to add the functionality to convert the case in the mirrored text to Title Case as well as separate the words with spaces instead of underscores.
This is a snippet from my snippet ;)
{{ Form::label('$1', '${1/\b(\w*)\b/\u\1/g}') }}
Right now when I type at position $1, the mirror text gets converted to title case.
So, the result in the blade document could be for example:
{{ Form::label('password', 'Password') }}
Now, I also want to change the mirror text to replace underscores with spaces and THEN convert to title case. This is the part I can't figure out.
So, instead of this:
{{ Form::label('password_confirmation', 'Password_confirmation') }}
I want to end up with this:
{{ Form::label('password_confirmation', 'Password Confirmation') }}
{{ Form::label('$1', '${1/^(\w)|(_(\w))/(?1:\u\1:)(?2: \u\3:)/g}') }}
Sublime Text uses Boost regular expressions which support conditionals.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With