Has it really been more than two months since my last post? And this one isn’t going to be up to my usual lengthy standards. I thought I’d share a transcription of an IM chat I had with our own Mark V. a while back:

Mark says: useful function would be to count the number of something in something: COUNT(”D-1000-3-BLACK”,”-”) would be 3
Mark says: would make it easier to use getpart when the number of parts varies
Anthony says: you know with GETPART you can put a negative number in and it counts from the end
Anthony says: like if you wanted the BLACK out of that, you could use GETPART(whatever,”-”,-1)
Anthony says: but if you really want the count, you could hack that with a regex
Anthony says: LENGTH(REGEXREPLACE(whatever,”[^-]”,”"))
Anthony says: that replaces everything that’s NOT a dash with a blank, so that the output of that is just dashes. Then length tells you how many

So there you go: two helpful hints in one blog post! I promise, though, I will post again in 2008!