\d
com letra minúscula d
. Você também pode pesquisar por não-dígitos usando um atalho semelhante que use um D
maiúsculo. O atalho para procurar caracteres não dígitos é \D
Isso é igual à classe de caracteres [^0-9]
, que procura um único caractere que não seja um número entre zero e nove. \D
para contar quantos não-dígitos estão em títulos de filme. "9"
.
testString: 'assert("9".match(noNumRegex) == null, "Your regex should find no non-digits in "9"
.");'
- text: Seu regex deve encontrar 6 não dígitos em "Catch 22"
.
testString: 'assert("Catch 22".match(noNumRegex).length == 6, "Your regex should find 6 non-digits in "Catch 22"
.");'
- text: Seu regex deve encontrar 11 não-dígitos em "101 Dalmatians"
.
testString: 'assert("101 Dalmatians".match(noNumRegex).length == 11, "Your regex should find 11 non-digits in "101 Dalmatians"
.");'
- text: 'Seu regex deve encontrar 15 não dígitos em "One, Two, Three"
.'
testString: 'assert("One, Two, Three".match(noNumRegex).length == 15, "Your regex should find 15 non-digits in "One, Two, Three"
.");'
- text: Seu regex deve encontrar 12 não dígitos em "21 Jump Street"
.
testString: 'assert("21 Jump Street".match(noNumRegex).length == 12, "Your regex should find 12 non-digits in "21 Jump Street"
.");'
- text: 'Seu regex deve encontrar 17 não-dígitos em "2001: A Space Odyssey"
.'
testString: 'assert("2001: A Space Odyssey".match(noNumRegex).length == 17, "Your regex should find 17 non-digits in "2001: A Space Odyssey"
.");'
```