Fix bugs in capture group definitions for start and end of strings