--- id: 587d7db8367417b2b2512ba0 title: Match Everything But Letters and Numbers challengeType: 1 videoUrl: '' localeTitle: 'Unir todo, excepto letras y números' --- ## Description
Ha aprendido que puede usar un atajo para hacer coincidir los caracteres alfanuméricos [A-Za-z0-9_] usando \w . Un patrón natural que quizás desee buscar es el opuesto a los alfanuméricos. Puedes buscar lo contrario de \w con \W Tenga en cuenta, el patrón opuesto utiliza una letra mayúscula. Este atajo es el mismo que [^A-Za-z0-9_] .
deja shortHand = / \ W /;
dejar números = "42%";
let sentence = "Coding!";
numbers.match (shortHand); // Devoluciones ["%"]
sentence.match (shortHand); // Devoluciones ["!"]
## Instructions
Use la clase de caracteres abreviados \W para contar el número de caracteres no alfanuméricos en varias comillas y cadenas.
## Tests
```yml tests: - text: Su expresión regular debe utilizar la bandera global. testString: 'assert(nonAlphabetRegex.global, "Your regex should use the global flag.");' - text: Su expresión regular debe encontrar 6 caracteres no alfanuméricos en "The five boxing wizards jump quickly." . testString: 'assert("The five boxing wizards jump quickly.".match(nonAlphabetRegex).length == 6, "Your regex should find 6 non-alphanumeric characters in "The five boxing wizards jump quickly.".");' - text: Tu expresión regular debe usar el carácter de taquigrafía. testString: 'assert(/\\W/.test(nonAlphabetRegex.source), "Your regex should use the shorthand character to match characters which are non-alphanumeric.");' - text: Su expresión regular debe encontrar 8 caracteres no alfanuméricos en "Pack my box with five dozen liquor jugs." testString: 'assert("Pack my box with five dozen liquor jugs.".match(nonAlphabetRegex).length == 8, "Your regex should find 8 non-alphanumeric characters in "Pack my box with five dozen liquor jugs."");' - text: Tu expresión regular debe encontrar 6 caracteres no alfanuméricos en "How vexingly quick daft zebras jump!" testString: 'assert("How vexingly quick daft zebras jump!".match(nonAlphabetRegex).length == 6, "Your regex should find 6 non-alphanumeric characters in "How vexingly quick daft zebras jump!"");' - text: Su expresión regular debe encontrar 12 caracteres no alfanuméricos en "123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ." testString: 'assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(nonAlphabetRegex).length == 12, "Your regex should find 12 non-alphanumeric characters in "123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."");' ```
## Challenge Seed
```js let quoteSample = "The five boxing wizards jump quickly."; let nonAlphabetRegex = /change/; // Change this line let result = quoteSample.match(nonAlphabetRegex).length; ```
## Solution
```js // solution required ```