I'm gonna suggest another solution that might be simpler to follow.
datetime text conversion will handle literals in a timestamp (the double-quoted format contains single-quote-escaped literals), and will handle day of year ("D", not "d"). So this
>> t1 = 'CM.SJC..HHE.D.2015.213.172556.SAC'
>> d1 = datetime(t1,'InputFormat',"'CM.SJC..HHE.D.'uuuu.DDD.HHmmss'.SAC'")
would be the way to go. Unfortunately, there's a fairly recent (and VERY narrowly-scoped) bug in parsing timestamps that causes that to error (thanks, Walter, for reporting it). That will be fixed, but for now, there are two work-arounds. One is to lower-case everything:
>> t2 = lower(t1)
d2 = datetime(t2,'InputFormat',"'cm.sjc..hhe.d.'uuuu.DDD.HHmmss'.sac'")
The other is to peel off the literals. In versions since R2016b it's easiest to use some string functions rather than regexp:
>> t3 = extractAfter(extractBefore(t1,".SAC"),"CM.SJC..HHE.D.")
d3 = datetime(t3,'InputFormat',"uuuu.DDD.HHmmss")
The above shows scalars, but of course it's completely vectorized.