| title | ms.date | ms.prod | ms.technology | ms.topic | f1_keywords | dev_langs | ms.assetid | author | ms.author | manager | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Invalid range in character set (JavaScript) | Microsoft Docs |
01/18/2017 |
visual-studio-windows |
vs-javascript |
error-reference |
|
|
971e9d5a-f88a-47a8-af94-f3c7c4aed5ab |
mikejo5000 |
mikejo |
ghogen |
You attempted to create a regular expression with an invalid character set range. Character sets must range from single characters only, such as a-z or 0-9; you cannot include character classes such as \w in a character set. The first character in the range must also come before the second character in the range. For example:
var good = /[a-z]/; // A valid character range - a comes before z.
var notGood = /[z-a]/; // An invalid character range - z does not come before a. - Use only single characters to compose your regular expression character set, and make sure they are in the correct order.
Regular Expression Object
Regular Expression Syntax (JavaScript)