I use the regex below to validate against any html tags in the text area. If someone enters any html tags in the text box, I should show a validation message,
Used expression:
/<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/
Can someone explain the above regex, I check it for any html tags in the text area, It works for all cases, but below CASE is not checked,
</p> passes the check without checking the client I do not want users to even enter the closing HTML tag
source share