Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm using a search plugin (SimplisticSearch) which for the most part is brilliant. I'm having an issue with stray HTML finding it's way into my code though.
I have the title as the link to the node and then a short description underneath which is pulled from the main body text of the page. In this text, I'm getting image tags and a hrefs and I would like to remove them.
I've had a look around and found (what I think) is the correct RegEx code to do this, but I'm struggling to get it working. Code below:
@foreach (var node in searchResults)
<li style="padding: 0 20px; border-bottom: 1px dashed #ccc;">
<p>@Html.Raw(node.Description ?? "")</p>
The (correct?) RegEx to use:
Regex.Replace(node.Description, "<.*?>", string.Empty)
If anyone has an elegant solution that just uses razor instead, that's also fine!
Not tested but there is/was the following helper...
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted