Add special characters escaping in count lines method