carltucker.com

Where I write whatever the hell I want.

Now they have two problems

Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.

Not always, though. Today a regular expression solved a problem pretty neatly. Turn “/some/arbitrary/length/path/in_a/string.ext” into “string.ext”. Oh, and it might not be called string.ext.

path.match(/[^\/]*$/)

Done.

I also ran into a situation which sed solved in a matter of seconds. I love it when something I learned long ago just for the hell of it ends up being useful.