Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular expression for one or more white spaces, tabs or newlines

Tags:

c#

regex

I am currently using this regex replace statement:

currentLine = Regex.Replace(currentLine, " {1,} \t \n", @" ");

It doesn't seem to be working.

I need a regular expression, that replaces white space(s), new line characters and/or tabs with a single white space.

Are there any other space characters, that I should have in mind ?

like image 554
Evaldas B Avatar asked Oct 30 '14 18:10

Evaldas B


1 Answers

For all whitespace use:

\s+

for specific chars you can use:

[ \t\n]+

Other space characters are \r and \f

like image 197
codenheim Avatar answered Oct 19 '22 04:10

codenheim