apply regex to text instead of line