Skip to content

Latest commit

 

History

History
32 lines (28 loc) · 1.29 KB

File metadata and controls

32 lines (28 loc) · 1.29 KB
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
VS.WebClient.Help.SCRIPT5021
JavaScript
TypeScript
DHTML
971e9d5a-f88a-47a8-af94-f3c7c4aed5ab
mikejo5000
mikejo
ghogen

Invalid range in character set (JavaScript)

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.  

To correct this error

  • Use only single characters to compose your regular expression character set, and make sure they are in the correct order.

See also

Regular Expression Object
Regular Expression Syntax (JavaScript)