Archive for March, 2016

Case Insensitive Regex for Clojure

Thursday, March 24th, 2016

Clojure.jpg

One of the things that I find I need to do every now and then is to have a case-insensitive regex pattern match in clojure, and I always have to spend 15 mins looking for it on the net. Not that it's hard to find, but it's 15 mins, and if I know I wrote about it here, then I can do a much quicker search, and get the same answer.

The key is that the Java regex parser recognizes two interesting options to the source for the regex: (?i) and (?iu). The first, (?i), is the flag to indicate that the entire regex is to be considered case-insensitive. The second, (?iu) is for unicode support.

So how's it work?

  (re-find #"Cook" "This is how to cook.")
  => nil
 
  (re-find #"(?i)Cook" "This is how to cook.")
  => "cook"

It's simple and easy, and typically saves you from calling lcase on the string before the regex test.

Upgraded to Adium 1.5.11b3

Wednesday, March 16th, 2016

Adium.jpg

This morning I noticed an upgrade notice in Adium, and while I wasn't going to go back to 1.5.11b2 - due to the Sparkle issues and security, I read it and the maintainers had created 1.5.11b3! While I know it's not making a lot of progress, it's something to see these updates shipping - it's not dead. And that's great news in my book.

Sure, Microsoft has killed Hotmail's IM support - and that's a shame, I don't understand why they wouldn't want to have users on their service, but that's their choice and not mine. I still hope that one day libpurple will support it, but that's a wish, not something I'm really holding my breath for.

But today it's nice to have Adium updated with the latest Sparkle and a few other fixes. Nice!