glob pattern matching in .NET

后端 未结 14 1475
遇见更好的自我
遇见更好的自我 2020-11-29 01:52

Is there a built-in mechanism in .NET to match patterns other than Regular Expressions? I\'d like to match using UNIX style (glob) wildcards (* = any number of any characte

14条回答
  •  余生分开走
    2020-11-29 02:28

    I found the actual code for you:

    Regex.Escape( wildcardExpression ).Replace( @"\*", ".*" ).Replace( @"\?", "." );
    

提交回复
热议问题