Fix a regression and make use of the proper anchor to get the end of string
Merge pull request #2630 from michelboaventura/master

Fix a regression and make use of the proper anchor to get the end of string