mardi 4 août 2015

Regex - Repeating negative character classes?

To put it simply, I have the regular expression: /[^0-9]+/gi

It is not stored as a string, but as a JavaScript regular expression. In other words, without quotation marks. My intention is to return an array of character classes consisting of characters that are not digits.

I expect to return this array when given the code: /[^0-9]+/gi.exec("rgb(123, 124, 125);");

However I only receive an array of length: 1 with index [0] being "rgb(". Why am I not getting an array consisting of the other non-digits like ); or ,?

Aucun commentaire:

Enregistrer un commentaire