Move castep regex out of analysis script

This should make it easer to use with other
code.