Regular expression to match any vertical whitespace

后端 未结 2 427
野趣味
野趣味 2021-01-20 17:57

Is there a regex pattern for .NET that will match any character that will result in multiple lines, i.e. any vertical whitespace character, like perl regex does with \

2条回答
  •  终归单人心
    2021-01-20 18:29

    As you say, the Perl character class \v matches [\x0A-\x0D] (linefeed, vertical tab, form feed and carriage-return (although I would dispute that CR is vertical white space)) in addition to the non-ASCII code points [\x{2028}\x{2029}] (line separator and paragraph separator).

    You can hand-build this character class in .NET like this

    [\u0A-\u0D\u2028\u2029]
    

提交回复
热议问题