JS RegExp
A regular expression describes a text pattern. Test returns whether the pattern matches anywhere in the string.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
const code = /^CLUB-\d{3}$/;
console.log(code.test("CLUB-204"));
console.log(code.test("CLUB-X"));
What happens
The first code matches and the second does not.