I have a model string which looks like:
bla bla bla <b>asdad</b> bla bla bla bla <u>bla</u> ...
My model:
public class MyModel {
[RegularExpression( @"^(<\s*([^ >]+)[^>]*>.*?<\s*\/\s*\1\s*>)$", ErrorMessage = "No tag is allowed !")]
public string Text { get; set; }
}
I tried to negate above regex ( I know that I didn't use correctly and I don't know how to do this correctly)
I want to show error when Text contains any match of HTML code, even it has no closed tag, means should occur when met:
<b> without </b>
</b> or similar
How to achieve this with regex ?