Hi,
Its better to use RegEx as like the below one,
class Program
{
static void Main(string[] args)
{
List<string> listOfPossibleStrings = GetStringsWithPossibleChars("abdfuwz",
new List<string>()
{
"jagan",
"bad",
"dad",
"well",
"test"
});
}
private static List<string> GetStringsWithPossibleChars(string pattern,List<string> lstStrings)
{
var newList = from str in lstStrings
where (new Regex(@"^[\s\d" + pattern + "]*$", RegexOptions.Singleline).IsMatch(str)== true)
select str;
return (List<string>)newList;
}
}