2.5 KiB
2.5 KiB
id, title, challengeType
id | title | challengeType |
---|---|---|
587d7db8367417b2b2512ba2 | Restrict Possible Usernames | 1 |
Description
Instructions
userCheck
to fit the constraints listed above.
Tests
tests:
- text: Your regex should match <code>JACK</code>
testString: assert(userCheck.test("JACK"), 'Your regex should match <code>JACK</code>');
- text: Your regex should not match <code>J</code>
testString: assert(!userCheck.test("J"), 'Your regex should not match <code>J</code>');
- text: Your regex should match <code>Jo</code>
testString: assert(userCheck.test("Jo"), 'Your regex should match <code>Jo</code>');
- text: Your regex should match <code>Oceans11</code>
testString: assert(userCheck.test("Oceans11"), 'Your regex should match <code>Oceans11</code>');
- text: Your regex should match <code>RegexGuru</code>
testString: assert(userCheck.test("RegexGuru"), 'Your regex should match <code>RegexGuru</code>');
- text: Your regex should not match <code>007</code>
testString: assert(!userCheck.test("007"), 'Your regex should not match <code>007</code>');
- text: Your regex should not match <code>9</code>
testString: assert(!userCheck.test("9"), 'Your regex should not match <code>9</code>');
- text: Your regex should not match <code>A1</code>
testString: assert(!userCheck.test("A1"), 'Your regex should not match <code>A1</code>');
- text: Your regex should not match <code>BadUs3rnam3</code>
testString: assert(!userCheck.test("BadUs3rnam3"), 'Your regex should not match <code>BadUs3rnam3</code>');
Challenge Seed
let username = "JackOfAllTrades";
let userCheck = /change/; // Change this line
let result = userCheck.test(username);
Solution
const userCheck = /^[A-Za-z]{2,}\d*$/;