Update 12_day_regular_expressions.md

Updates Regular Expression code examples. The first code example using the special character 'd' is changed so that the desired outcome is elucidated, the second example explains what the + special character does
pull/795/head
evabth 2 years ago committed by GitHub
parent 55d8e3dbc0
commit a63839bae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -313,13 +313,13 @@ const pattern = /\d+/g // d is a special character which means digits
const txt = 'This regular expression example was made in January 12, 2020.'
const matches = txt. match(pattern)
console.log(matches) // ["12", "2020"], this is not what we want
console.log(matches) // ["12", "2020"], this is what we want
```
### One or more times(+)
```js
const pattern = /\d+/g // d is a special character which means digits
const pattern = /\d+/g // + is a special character that matches one or more occurences of the preceding element
const txt = 'This regular expression example was made in January 12, 2020.'
const matches = txt. match(pattern)
console.log(matches) // ["12", "2020"], this is not what we want

Loading…
Cancel
Save