Match a Literal String with Different Possibilities1

Tell us what’s happening:
oh this is hard I can do it

Your code so far


let petString = "James has a pet cat.";
let petRegex = /Emma has a pet rock./; // Change this line
let result = petRegex.test(petString);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/match-a-literal-string-with-different-possibilities

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

from the challenge:

Complete the regex petRegex to match the pets “dog”, “cat”, “bird”, or “fish”.

Do you think your petRegex will match all four of these words?

I believe I will not match all 4 words.

You need to put all words you wanna match in the regex.

Thank you I got it tHank you for helping

You’re welcome.
Happing code!