Fix bug with ^ anchor in some regular expressions