Adding EOL and BOL markers for patterns