// Practice Set · JS RegExp · guest

Guest practice: this set is not saved and does not count.

Question 1 of 5 from: JS RegExp

What does this log?

const msg = "Order 42 shipped. Order 57 pending.";
console.log(msg.search(/\d/), msg.replace(/\d+/g, "#"));
Question 2 of 5 from: JS RegExp

What does this log?

console.log(new RegExp("\d+").test("42"), new RegExp("\\d+").test("42"));
Question 3 of 5 from: JS RegExp Flags

What does this log?

const re = /a/g;
console.log(re.test("a"), re.test("a"), re.test("a"));
Question 4 of 5 from: JS RegExp Classes

What does this log?

const word = "caf\u00e9";
console.log(word.match(/\w+/)[0].length, word.match(/\p{L}+/u)[0].length);
Question 5 of 5 from: JS RegExp Metachars

What does this log?

console.log(/^cat|dog$/.test("hotdog"), /^(cat|dog)$/.test("hotdog"));
Ready to submit?

Click a question to go back and check it. After you submit, you will see the right answer and an explanation for every question. As a guest, nothing is saved.