Match beginning and end in regexp