fixed up regex for before '^' matching