// Practice Set · JS RegExp (Part 2) · guest

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

Question 1 of 5 from: JS RegExp Groups

What does this log?

const m = "Due: 2026-10-02".match(/(\d{4})-(\d{2})-(\d{2})/);
console.log(m[0], m[2], m.length);
Question 2 of 5 from: JS RegExp Groups

What does this log?

console.log("Lovelace, Ada".replace(/(?<last>\w+), (?<first>\w+)/, "$<first> $<last>"), "2026-10-02".replace(/(\d{4})-(\d{2})-(\d{2})/, "$2/$3/$1"));
Question 3 of 5 from: JS RegExp Groups

What does this log?

const text = "This is is a test of the the checker";
console.log(text.match(/\b(\w+) \1\b/g));
Question 4 of 5 from: JS RegExp Patterns

What does this log?

const hex = /^#(?:[0-9a-f]{3}){1,2}$/i;
console.log(hex.test("#fff"), hex.test("#1A2b3C"), hex.test("#abcd"));
Question 5 of 5 from: JS RegExp Objects

/a/ === /a/ is true because both regexes have the same pattern.

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.