This regex is used to check some user input:
/^[^<">]*$/
What is it checking for?
This regex is used to check some user input:
/^[^<">]*$/
What is it checking for?
It's checking for a line (possibly empty) that doesn't contain <, > or ".
It's checking for double quotes ("
) and angle brackets (<>
).
/^[^<">]*$/
/^
means the start of the string.
[^<">]
means not <
, "
, or >
.
*
means zero or more of the previous expression.
$/
means the end of the string.
So it's checking whether the input consists of zero or more characters, none of which are <>"
.
This is probably a simple regex being used to check for an xml element with an attribute.
It ensures that the input contains no <
"
or >
characters.
^
at the beginning matches the literal beginning of the string.
[^<">]*
matches 0 or more characters that ARENT one of the three: <">
.
$
at the end matches the literal end of the string.
/^[^<">]*$/
To be clear: it does not match any string that contains <, >, or ".
It will match anything else.
Matching a string against this RegEx will return FALSE if any double-quotes or brackets exist in the string. If none exist, or the string is empty, it will return TRUE.