I used RegEx to remove HTML TAGS within LINQ-SQL query but the following error has thrown:
Method
'System.String Replace(System.String, System.String, System.String)'
is not supported for execution as SQL.
Help helpDBSession = new Help();
IEnumerable<Article> articles = null;
if (lang.ToLower() == "en")
{
articles = helpDBSession.Articles.Where(artilce => artilce.NameEn.Contains(searchPattern) ||
System.Text.RegularExpressions.Regex.Replace(artilce.ContentEn, "<(.|\n)*?>",String.Empty).Contains(searchPattern));
}
else
{
articles = helpDBSession.Articles.Where(artilce => artilce.NameAr.Contains(searchPattern) ||
System.Text.RegularExpressions.Regex.Replace(artilce.ContentAr, "<(.|\n)*?>", String.Empty).Contains(searchPattern));
}
if (articles != null && articles.Count() > 0)
{
return articles.ToList();
}