JavaScript Regular Expression Plus Sign +

The Plus Sign (+) special character is used in JavaScript regular expressions to match one or more occurrences of the previous item.

var NumberToTest = '1234';
var IsFound = /^\d+$/.test(NumberToTest);
alert(IsFound);

The preceding code will return true for any length of digits that begin and end with a digit.

Related articles:
JavaScript Regular Expressions
JavaScript Regular Expression Special Characters: $ ^

Leave a Reply