3 ms·
It may be limited, but seems to be a good start: $ cat <<HN | sed -e '/@/ s/\([a-z]\)\([A-Z]\)/\1-\l\2/g' > The following sed will replace camelCase only
by flaie 14y ago
It may be limited, but seems to be a good start:
$ cat <<HN | sed -e '/@/ s/\([a-z]\)\([A-Z]\)/\1-\l\2/g'
> The following sed will replace camelCase only if it can find an arobase
> character in the current line, thus fooBar and bazThing won't be replaced
> but @fooBar and @awesomeFooBarBazzProperty will.
> True story.
> HN
The following sed will replace camelCase only if it can find an arobase
character in the current line, thus fooBar and bazThing won't be replaced
but @foo-bar and @awesome-foo-bar-bazz-property will.
True story.