You need to match using the or operation between the strings you wanna match. Like the example it show, if you put/cat|dog/ as regex in the string "You are a cat people?" it match the "cat" and in the string "You are a dog people?" it match the "dog".
Hope it help you.
I write that code:
let petString = “James has a pet cat.”;
let petRegex = /cat|dog/; // Change this line
let result = petRegex.test(petString);
But tell me that:
// running test
Your regex petRegex should return true for the string “Emma has a pet bird.”
Your regex petRegex should return true for the string “Alice has a pet fish.”
// tests completed