* Use dfn tags
* remove misused <dfn> tags
* Revert "remove misused <dfn> tags"
This reverts commit b24968a968.
* Update curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/fill-in-the-blank-with-placeholder-text.english.md
Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
* Make "array" lowercase
Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
* Fix dfn usage
* Address last dfn tags
		
	
		
			
				
	
	
		
			80 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | |
| id: 587d7db9367417b2b2512ba7
 | |
| title: Specify Exact Number of Matches
 | |
| challengeType: 1
 | |
| forumTopicId: 301365
 | |
| ---
 | |
| 
 | |
| ## Description
 | |
| <section id='description'>
 | |
| You can specify the lower and upper number of patterns with quantity specifiers using curly brackets. Sometimes you only want a specific number of matches.
 | |
| To specify a certain number of patterns, just have that one number between the curly brackets.
 | |
| For example, to match only the word <code>"hah"</code> with the letter <code>a</code> <code>3</code> times, your regex would be <code>/ha{3}h/</code>.
 | |
| 
 | |
| ```js
 | |
| let A4 = "haaaah";
 | |
| let A3 = "haaah";
 | |
| let A100 = "h" + "a".repeat(100) + "h";
 | |
| let multipleHA = /ha{3}h/;
 | |
| multipleHA.test(A4); // Returns false
 | |
| multipleHA.test(A3); // Returns true
 | |
| multipleHA.test(A100); // Returns false
 | |
| ```
 | |
| 
 | |
| </section>
 | |
| 
 | |
| ## Instructions
 | |
| <section id='instructions'>
 | |
| Change the regex <code>timRegex</code> to match the word <code>"Timber"</code> only when it has four letter <code>m</code>'s.
 | |
| </section>
 | |
| 
 | |
| ## Tests
 | |
| <section id='tests'>
 | |
| 
 | |
| ```yml
 | |
| tests:
 | |
|   - text: Your regex should use curly brackets.
 | |
|     testString: assert(timRegex.source.match(/{.*?}/).length > 0);
 | |
|   - text: Your regex should not match <code>"Timber"</code>
 | |
|     testString: assert(!timRegex.test("Timber"));
 | |
|   - text: Your regex should not match <code>"Timmber"</code>
 | |
|     testString: assert(!timRegex.test("Timmber"));
 | |
|   - text: Your regex should not match <code>"Timmmber"</code>
 | |
|     testString: assert(!timRegex.test("Timmmber"));
 | |
|   - text: Your regex should match <code>"Timmmmber"</code>
 | |
|     testString: assert(timRegex.test("Timmmmber"));
 | |
|   - text: Your regex should not match <code>"Timber"</code> with 30 <code>m</code>'s in it.
 | |
|     testString: assert(!timRegex.test("Ti" + "m".repeat(30) + "ber"));
 | |
| 
 | |
| ```
 | |
| 
 | |
| </section>
 | |
| 
 | |
| ## Challenge Seed
 | |
| <section id='challengeSeed'>
 | |
| 
 | |
| <div id='js-seed'>
 | |
| 
 | |
| ```js
 | |
| let timStr = "Timmmmber";
 | |
| let timRegex = /change/; // Change this line
 | |
| let result = timRegex.test(timStr);
 | |
| ```
 | |
| 
 | |
| </div>
 | |
| 
 | |
| 
 | |
| 
 | |
| </section>
 | |
| 
 | |
| ## Solution
 | |
| <section id='solution'>
 | |
| 
 | |
| ```js
 | |
| let timStr = "Timmmmber";
 | |
| let timRegex = /Tim{4}ber/; // Change this line
 | |
| let result = timRegex.test(timStr);
 | |
| ```
 | |
| 
 | |
| </section>
 |