How to completely ignore linebreak and tab in RegEx?

后端 未结 4 649
-上瘾入骨i
-上瘾入骨i 2020-12-18 22:54

Is there any way to completely ignore line break and tab characters etc. in RegEx? For instance, the line break and tab characters could be found anywhere and in any order

4条回答
  •  时光说笑
    2020-12-18 23:31

    do you need the tab/newline? You could always just replace the tab/newline character with an empty character to remove them.

    string mystring = "\t\nhi\t\n";
    
    string mystring_notabs = mystring.Replace("\t",""); //remove tabs
    
    mystring = mystring_notabs.Replace("\n",""); //remove newline and copy back to original
    

提交回复
热议问题