Update match-anything-with-wildcard-period.english.md (#35696)
A fix for issue #35089, updated the examples in the description to use .test() instead of .match() to better reflect the challenge
This commit is contained in:
committed by
Randell Dawson
parent
7dec6425f4
commit
b0565aa8d0
@ -8,7 +8,7 @@ challengeType: 1
|
||||
<section id='description'>
|
||||
Sometimes you won't (or don't need to) know the exact characters in your patterns. Thinking of all words that match, say, a misspelling would take a long time. Luckily, you can save time using the wildcard character: <code>.</code>
|
||||
The wildcard character <code>.</code> will match any one character. The wildcard is also called <code>dot</code> and <code>period</code>. You can use the wildcard character just like any other character in the regex. For example, if you wanted to match <code>"hug"</code>, <code>"huh"</code>, <code>"hut"</code>, and <code>"hum"</code>, you can use the regex <code>/hu./</code> to match all four words.
|
||||
<blockquote>let humStr = "I'll hum a song";<br>let hugStr = "Bear hug";<br>let huRegex = /hu./;<br>humStr.match(huRegex); // Returns ["hum"]<br>hugStr.match(huRegex); // Returns ["hug"]</blockquote>
|
||||
<blockquote>let humStr = "I'll hum a song";<br>let hugStr = "Bear hug";<br>let huRegex = /hu./;<br>humStr.test(huRegex); // Returns true<br>hugStr.test(huRegex); // Returns true</blockquote>
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
Reference in New Issue
Block a user