* chore(learn): audit basic algorithm scripting * chore(learn): audit basic data structures * chore(learn): audit basic javascript * chore(learn): audit debugging * chore(learn): audit es6 * chore(learn): audit functional programming * chore(learn): audit intermidate algorithms * chore(learn): audit js projects * chore(learn): audit object oriented programming * chore(learn): audit regex * fix(learn): remove stray . * fix(learn): string to code * fix(learn): missed some * fix(learn): clarify strings Based on Randy's feedback, clarifies string instances where quotes were removed in favour of back ticks. * fix: apply suggestions - thanks Randy! :) Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * fix: non-suggestion comments * chore(learn): remove comments from codes Removes the comments from the description and instruction code blocks to ensure that all relevant information is translatable. * fix: Apply suggestions from code review Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * fix: revert crowdin fix * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations.md Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * fix: Apply suggestions from code review Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * fix: Apply suggestions from code review Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * chore: change voice * fix: Christopher Nolan * fix: expressions would evaluate * fix: will -> would * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.md Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * fix: to work to push * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/object-oriented-programming/add-methods-after-inheritance.md Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
		
			
				
	
	
		
			124 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			124 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | |
| id: 587d7db8367417b2b2512ba2
 | |
| title: Restrict Possible Usernames
 | |
| challengeType: 1
 | |
| forumTopicId: 301363
 | |
| dashedName: restrict-possible-usernames
 | |
| ---
 | |
| 
 | |
| # --description--
 | |
| 
 | |
| Usernames are used everywhere on the internet. They are what give users a unique identity on their favorite sites.
 | |
| 
 | |
| You need to check all the usernames in a database. Here are some simple rules that users have to follow when creating their username.
 | |
| 
 | |
| 1) Usernames can only use alpha-numeric characters.
 | |
| 
 | |
| 2) The only numbers in the username have to be at the end. There can be zero or more of them at the end. Username cannot start with the number.
 | |
| 
 | |
| 3) Username letters can be lowercase and uppercase.
 | |
| 
 | |
| 4) Usernames have to be at least two characters long. A two-character username can only use alphabet letters as characters.
 | |
| 
 | |
| # --instructions--
 | |
| 
 | |
| Change the regex `userCheck` to fit the constraints listed above.
 | |
| 
 | |
| # --hints--
 | |
| 
 | |
| Your regex should match the string `JACK`
 | |
| 
 | |
| ```js
 | |
| assert(userCheck.test('JACK'));
 | |
| ```
 | |
| 
 | |
| Your regex should not match the string `J`
 | |
| 
 | |
| ```js
 | |
| assert(!userCheck.test('J'));
 | |
| ```
 | |
| 
 | |
| Your regex should match the string `Jo`
 | |
| 
 | |
| ```js
 | |
| assert(userCheck.test('Jo'));
 | |
| ```
 | |
| 
 | |
| Your regex should match the string `Oceans11`
 | |
| 
 | |
| ```js
 | |
| assert(userCheck.test('Oceans11'));
 | |
| ```
 | |
| 
 | |
| Your regex should match the string `RegexGuru`
 | |
| 
 | |
| ```js
 | |
| assert(userCheck.test('RegexGuru'));
 | |
| ```
 | |
| 
 | |
| Your regex should not match the string `007`
 | |
| 
 | |
| ```js
 | |
| assert(!userCheck.test('007'));
 | |
| ```
 | |
| 
 | |
| Your regex should not match the string `9`
 | |
| 
 | |
| ```js
 | |
| assert(!userCheck.test('9'));
 | |
| ```
 | |
| 
 | |
| Your regex should not match the string `A1`
 | |
| 
 | |
| ```js
 | |
| assert(!userCheck.test('A1'));
 | |
| ```
 | |
| 
 | |
| Your regex should not match the string `BadUs3rnam3`
 | |
| 
 | |
| ```js
 | |
| assert(!userCheck.test('BadUs3rnam3'));
 | |
| ```
 | |
| 
 | |
| Your regex should match the string `Z97`
 | |
| 
 | |
| ```js
 | |
| assert(userCheck.test('Z97'));
 | |
| ```
 | |
| 
 | |
| Your regex should not match the string `c57bT3`
 | |
| 
 | |
| ```js
 | |
| assert(!userCheck.test('c57bT3'));
 | |
| ```
 | |
| 
 | |
| Your regex should match the string `AB1`
 | |
| 
 | |
| ```js
 | |
| assert(userCheck.test('AB1'));
 | |
| ```
 | |
| 
 | |
| Your regex should not match the string `J%4`
 | |
| 
 | |
| ```js
 | |
| assert(!userCheck.test('J%4'))
 | |
| ```
 | |
| 
 | |
| # --seed--
 | |
| 
 | |
| ## --seed-contents--
 | |
| 
 | |
| ```js
 | |
| let username = "JackOfAllTrades";
 | |
| let userCheck = /change/; // Change this line
 | |
| let result = userCheck.test(username);
 | |
| ```
 | |
| 
 | |
| # --solutions--
 | |
| 
 | |
| ```js
 | |
| let username = "JackOfAllTrades";
 | |
| const userCheck = /^[a-z]([0-9]{2,}|[a-z]+\d*)$/i;
 | |
| let result = userCheck.test(username);
 | |
| ```
 |