Follow

computer nonsense, regexes, arcane computer magic 

Much of my early coding was in Perl, so I have been writing regular expressions for well over a decade now, and as a result am very good at reading and writing them. None of that means they feel one bit less like arcane magic.

This brought to you by my quick and dirty snake-case to CamelCase conversion:

perl -p -e 's/\b-?(\w)/\U\1/g'

Like, it works and I can parse it out but is sure is impenetrable at first glance for such a simple transformation!

· · Web · 1 · 0 · 1

computer nonsense, regexes, arcane computer magic 

Also, disclaimers: this is for a very limited-scope one-off bash kludge, I do not care how robust it is, and also please never do this in any context where someone else might have to read your code. I guarantee there's a built-in or readily-available library method in practically every language to do this. Heck, there might be a standard bash util I'm not aware of!

computer nonsense, regexes, arcane computer magic 

@cincodenada now I'm thinking of how I'd do this for readability! split, cap, join I guess?

Sign in to participate in the conversation
Cybrespace

cybrespace: the social hub of the information superhighway jack in to the mastodon fediverse today and surf the dataflow through our cybrepunk, slightly glitchy web portal support us on patreon or liberapay!