C# Regular Expressions with \Uxxxxxxxx characters in the pattern

后端 未结 3 1933
孤城傲影
孤城傲影 2020-12-19 07:21
Regex.IsMatch( \"foo\", \"[\\U00010000-\\U0010FFFF]\" ) 

Throws: System.ArgumentException: parsing \"[-]\" - [x-y] range in reverse order.

3条回答
  •  星月不相逢
    2020-12-19 08:10

    @Jon Skeet

    So what you are telling me is that there is not a way to use the Regex tools in .net to match on chars outside of the utf-16 range?

    The full regex is:

    ^(\u0009|[\u0020-\u007E]|\u0085|[\u00A0-\uD7FF]|[\uE000-\uFFFD]|[\U00010000-\U0010FFFF])+$
    

    I am attempting to check if a string only contains what a yaml document defines as printable Unicode chararters.

提交回复
热议问题