Tech Off Post

Single Post Permalink

View Thread: File SearchPattern in .NET
  • User profile image

    Just use regex.

    Have the user input a normal file mask, but befor you use what he have you, do this:

    string fromuser = "get string from user";

    fromuser = fromuser.replace(".","\\."
    fromuser = fromuser.replace("*",".*");
    fromuser = fromuser.replace("?",".");

    Of course you also need put slashes in fronot of the other special regex chars Smiley