/coding/ , puede buscar el patrón "coding" en otra cadena. Esto es poderoso para buscar cadenas simples, pero está limitado a un solo patrón. Puede buscar múltiples patrones utilizando la alternation u operador OR : | . Este operador hace coincidir los patrones antes o después de él. Por ejemplo, si desea hacer coincidir "yes" o "no" , la expresión regular que desea es /yes|no/ . También puede buscar más de dos patrones. Puede hacer esto agregando más patrones con más operadores OR que los separan, como /yes|no|maybe/ . petRegex para que coincida con las mascotas "dog" , "cat" , "bird" o "fish" . petRegex debe devolver true para la cadena "John has a pet dog."
testString: 'assert(petRegex.test("John has a pet dog."), "Your regex petRegex should return true for the string "John has a pet dog."");'
- text: Su regex petRegex debe devolver false para la cadena "Emma has a pet rock."
testString: 'assert(!petRegex.test("Emma has a pet rock."), "Your regex petRegex should return false for the string "Emma has a pet rock."");'
- text: Tu regex petRegex debe devolver true para la cadena "Emma has a pet bird."
testString: 'assert(petRegex.test("Emma has a pet bird."), "Your regex petRegex should return true for the string "Emma has a pet bird."");'
- text: Tu regex petRegex debe devolver true para la cadena "Liz has a pet cat."
testString: 'assert(petRegex.test("Liz has a pet cat."), "Your regex petRegex should return true for the string "Liz has a pet cat."");'
- text: Su regex petRegex debe devolver false para la cadena "Kara has a pet dolphin."
testString: 'assert(!petRegex.test("Kara has a pet dolphin."), "Your regex petRegex should return false for the string "Kara has a pet dolphin."");'
- text: Su regex petRegex debe devolver true para la cadena "Alice has a pet fish."
testString: 'assert(petRegex.test("Alice has a pet fish."), "Your regex petRegex should return true for the string "Alice has a pet fish."");'
- text: Su regex petRegex debe devolver false para la cadena "Jimmy has a pet computer."
testString: 'assert(!petRegex.test("Jimmy has a pet computer."), "Your regex petRegex should return false for the string "Jimmy has a pet computer."");'
```