Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

regex matches line break-why?

in notepad++ this pattern ([\t\s\,])+ which I intended to match a tab a space or a comma matches line breaks (\r\n in notepad). Why is this?

like image 802
1252748 Avatar asked Mar 21 '23 22:03

1252748


1 Answers

\s represents any white space character. It will match tabs, but it will also match new lines and carriage returns because those too are white space characters.

If you want to just match tabs, spaces, or commas, use a pattern like this:

[\t ,]+
like image 111
p.s.w.g Avatar answered Mar 31 '23 23:03

p.s.w.g