c# - How to set windows path regex pattern? -
i have list of paths, , need match starting c:\program files\_folder_\_folder_\etc
, having amount , type of character windows path can use. how approach, though guess allows alpanumeric characters:
string pathpattern = @"c:\program files\_folder_\_folder_\etc[0-z]*"; if (system.text.regularexpressions.regex.ismatch(mylist[n], pathpattern, system.text.regularexpressions.regexoptions.ignorecase) { //some action }
if c:\program files\_folder_\_folder_\etc
pre-defined part. think can without regex
using contains
if(pathpattern.contains(@"c:\program files\_folder_\_folder_\etc")) { //some action }
edit 1: can tolower()
on pathpattern
var ss = pathpattern.tolower().contains(@"c:\program files\_folder_\_folder_\etc".tolower());
Comments
Post a Comment