Skip to content

Commit 6f16325

Browse files
authored
regular expressions examples typo fixes
1 parent c8eab85 commit 6f16325

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

12_Day/12_day_regular_expressions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Zero or many times. The pattern could may not occur or it can occur many times.
350350

351351
const pattern = /[a].*/g //. any character, + any character one or more times
352352
const txt = 'Apple and banana are fruits'
353-
const matches = re.match(pattern)
353+
const matches = txt.match(pattern)
354354

355355
console.log(matches) // ['and banana are fruits']
356356

@@ -383,7 +383,7 @@ console.log(matches) // ['2019']
383383

384384
```js
385385
const txt = 'This regular expression example was made in December 6, 2019.'
386-
const regex_pattern = /\d{1, 4}/g // 1 to 4
386+
const pattern = /\d{1,4}/g // 1 to 4
387387
const matches = txt.match(pattern)
388388
console.log(matches) // ['6', '2019']
389389
```
@@ -396,7 +396,7 @@ console.log(matches) // ['6', '2019']
396396
const txt = 'This regular expression example was made in December 6, 2019.'
397397
const pattern = /^This/ // ^ means starts with
398398
const matches = txt.match(pattern)
399-
console.log(matches) / ['This']
399+
console.log(matches) // ['This']
400400
```
401401

402402
- Negation
@@ -405,12 +405,12 @@ console.log(matches) / ['This']
405405
const txt = 'This regular expression example was made in December 6, 2019.'
406406
const pattern = /[^A-Za-z,. ]+/g // ^ in set character means negation, not A to Z, not a to z, no space, no coma no period
407407
const matches = txt.match(pattern)
408-
console.log(matches) ["6", "2019"]
408+
console.log(matches) // ["6", "2019"]
409409
```
410410

411411
### Exact match
412412

413-
It should hav ^ starting and $ which is an end.
413+
It should have ^ starting and $ which is an end.
414414

415415
```js
416416
let pattern = /^[A-Z][a-z]{3,12}$/;

0 commit comments

Comments
 (0)