« first day (73 days earlier)      last day (1254 days later) » 

12:23 AM
your 48 fails to match numbers of the form 2^n + 1
 
I disagree, when ((xx)?x*) is 1, \2 is x, so (?!(x\2+)\5+$) will match non-composites (not 2^n). Unless you've tested it and found it to not work?
 
1:06 AM
% ./regex -nx '^(?!((xx?)x*)(((?!(x\2+)\5+$)x*(?=\1$)){2})?\1$)' -t 262145
262145 -> 0
 

« first day (73 days earlier)      last day (1254 days later) »