Does anyone have this Regular Expression?
public static class HtmlAttributeValidator{
const bool REGEX_OPTIONS = RegexOptions.WhatGoesHere;
const string VALID_ATTRIBUTE_REGEX = @"What goes here?";
public static bool IsValidHtmlAttributeValue(string attributeValue){
return Regex.Match(attributeValue ?? string.Empty,
VALID_ATTRIBUTE_REGEX,
REGEX_OPTIONS);
}
}
You will not find such a regular expression, because many attribute values can take any valid textual value, hence the values are not regular and can’t be matched by a regular expression.
See this list of HTML attributes and the values they can take. In particular note the ones that take CDATA values: