Checks whether pattern is a valid search expression. Pattern is invalid when meets following conditions:
- contains any of invalid path characters (except * and ? which are used as wildcards)
- starts with two periods ("..")
- ends with two periods
public static bool ValidatePattern(
string pattern
)