Match a Literal String with Different Possibilities
Summary
- Adding
|
to a Regex can be used to add search items to a single .text
.
Final Code
let petString = "James has a pet cat.";
let petRegex = /dog|cat|bird|fish/; // Change this line
let result = petRegex.test(petString);