[feature/twig] Fix length replace in lexer

PHPBB3-11598