Home » Web Development » 05 - Client Side Scripting Concepts
5

Quantitative Operators

Summary of quantitative operators used in javascript

[] Any characters within these are interpreted as a set rather than a sequence. Any member of the set returns a positive match. For example, [abd] matches either a, b, or d rather than the pattern abd.[0-9] is the same as \d; both match a single digit
[^ ] Negation. Positive match returns only when characters NOT within the square braces are found. [^0-9] matches any character but a digit.
* Matches 0 or more of preceding character or set of characters
+ Matches 1 or more of the preceding character or set of characters
? Matches 0 or 1 of the preceding character or set of characters
{1,} Searches for at least 1 of the preceding character or set of characters. Any integer may be used instead of 1.
{2,5} Looks for exactly between two and five occurrences of the previous character or set of characters. The two parameters sould be any integer.