W3C home > Mailing lists > Public > www-validator@w3.org > February 2018

Re: Bug report / Question on "Error: JS: SyntaxError: Invalid range in character class."

From: Luis Garcia <lgarcia@ebcomm.mx>
Date: Mon, 26 Feb 2018 12:09:35 -0600
To: "O'Guin, Phaewryn" <JDO09280@ccv.vsc.edu>, "www-validator@w3.org" <www-validator@w3.org>
Message-ID: <98a0d6c7-f21f-6278-8ecf-87ed7feac128@ebcomm.mx>
Well, you was totally right about the hyphens! Moving the hyphen to the 
end of the square brackets did the trick, instead of escaping it.

     var product_price_regex_text = /[^\$\d-\.,]+/g;
     var product_price_regex_price = /\$[\d-\.,]+/;
     var product_price_regex_text = /[^\$\d\.,-]+/g;
     var product_price_regex_price = /\$[\d\.,-]+/;

Nevertheless, i hope that an update in the validator can point the lines 
of code that is causing the problem, instead of just popping the error 
with no more further explanation.

Thank you so much.

El 20/02/18 a las 16:04, O'Guin, Phaewryn escribió:
> Probably an issue at a regex line such as seen at “var 
> product_price_regex_numeric=/[^\d.-]+/g;$("input[type='text']” in your 
> code, as you need to escape the hypen or it reads it as a range 
> instead of as intended. “within a character class, you can place a 
> hyphen as the first or last character in the range (e.g. |[-a-z]|or 
> |[0-9-]|), *OR* escape it (e.g. |[a-z\-0-9]|) in order to add ‘hyphen’ 
> to your class” from 
> https://stackoverflow.com/questions/9589074/regex-should-hyphens-be-escaped 
> Regards,
> Phaewryn (J.D.) O’Guin
> *From:*Luis Garcia [mailto:lgarcia@ebcomm.mx]
> *Sent:* Monday, February 19, 2018 5:06 PM - 17:06 PM
> *To:* www-validator@w3.org
> *Subject:* Bug report / Question on "Error: JS: SyntaxError: Invalid 
> range in character class."
> Hi.
> I check my sites on a regular basis in https://validator.w3.org, this 
> tool has helped me reducing html5 errors to zero, thank you so much!
> But starting this week, i got a strange error:
> *Error**: JS: SyntaxError: Invalid range in character class.*
> https://tigretienda.com/
> With no extra input on the error itself, i don't know what to do. But 
> i think is some kind of new feature on the validator because before 
> that the site performed well on the validator (all green). These sites 
> has the same behavior:
> https://cookingdepot.com/
> https://tiendanecaxa.mx/
> https://prada.mx/
> Can you help me with that? if you need more information please let me 
> know.
> I attach a pdf with the results for the site https://tigretienda.com/ 
> <https://tigretienda.com/>
> Thanks.
> -- 
> Luis García

Luis García
Received on Monday, 26 February 2018 18:10:10 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:00:03 UTC