Regex to Match Horizontal White Spaces

前端 未结 3 1467
眼角桃花
眼角桃花 2020-12-11 15:45

I need a regex in Python2 to match only horizontal white spaces not newlines.

\\s matches all whitespaces including newlines.

>&         


        
3条回答
  •  有刺的猬
    2020-12-11 16:36

    As there are fewer vertical white space characters (line terminators) than horizontal ones, it will be shorter to blacklist the first category than to white list the second category. But you still need to list a few more than just \n:

    [^\S\n\v\f\r\u2028\u2029]
    

提交回复
热议问题