It suppose to return me 4 rows and not 7. Similar behavior found with pattern '$'.
It seems that these start and end anchor characters are not matching correctly. Or rather they are matching twice.
To get a root cause of it, I put elog(INFO,..) into the setup_regexp_matches() function where we copy matches into the struct and found following values.