2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Match Anything with Wildcard Period
|
|
|
|
---
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
# Match Anything with Wildcard Period
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
## Hints
|
|
|
|
|
|
|
|
### Hint 1
|
2018-10-12 15:37:13 -04:00
|
|
|
The dot `.` is the key in this challenge.
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
### Hint 2
|
2018-10-12 15:37:13 -04:00
|
|
|
You should put the dot on the right position.
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
## Solutions
|
|
|
|
|
|
|
|
<details><summary>Solution 1 (Click to Show/Hide)</summary>
|
|
|
|
|
2018-10-12 15:37:13 -04:00
|
|
|
```javascript
|
|
|
|
let exampleStr = "Let's have fun with regular expressions!";
|
|
|
|
let unRegex = /.un/; // Change this line
|
|
|
|
let result = unRegex.test(exampleStr);
|
|
|
|
```
|
2019-07-24 00:59:27 -07:00
|
|
|
#### Code Explanation
|
2018-10-12 15:37:13 -04:00
|
|
|
The period `.` will be any one character so the strings "run", "sun", "fun" and "pun" have the same un charaters.
|
2019-07-24 00:59:27 -07:00
|
|
|
</details>
|
2018-10-12 15:37:13 -04:00
|
|
|
|