Reputation: 6852
I am using the following regexp for XSS attack validation. Its checking <..> </>
datas correctly. But when I type single character at first its not allowing any single character (eg: if I type 'a' its not allowing). Can anyone help me on this?
/^(|\/|[^\/>][^>]+|\/[^>][^>]+)$/
Upvotes: 0
Views: 52
Reputation: 1481
Despite the fact that Regex is not optimal for XSS attack validation as comments said :
This regex need at least two characters because of the two +
, which means between one and unlimited characters. *
can be used to specify between zero and unlimited characters.
Upvotes: 1