Merge pull request #3100 from joaquinelio/patch-11

This commit is contained in:
Ilya Kantor 2022-08-14 15:00:22 +03:00 committed by GitHub
commit cbd7d7831c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -232,10 +232,10 @@ Using a function gives us the ultimate replacement power, because it gets all th
This method is essentially the same as `str.replace`, with two major differences:
1. If the first argument is a string, it replaces *all occurences* of the string, while `replace` replaces only the *first occurence*.
1. If the first argument is a string, it replaces *all occurrences* of the string, while `replace` replaces only the *first occurrence*.
2. If the first argument is a regular expression without the `g` flag, there'll be an error. With `g` flag, it works the same as `replace`.
The main use case for `replaceAll` is replacing all occurences of a string.
The main use case for `replaceAll` is replacing all occurrences of a string.
Like this: