You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 9-regular-expressions/04-regexp-anchors/article.md
+1-6Lines changed: 1 addition & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,13 +16,8 @@ O padrão `pattern:^Maria` quer dizer: "início da string, e então Maria"
16
16
Da mesma maneira, podemos testar se a string termina com `neve` usando `pattern:neve$`:
17
17
18
18
```js run
19
-
<<<<<<<HEAD
20
19
let str1 ="Seu velo era branco como a neve";
21
20
alert(/neve$/.test(str1) ); // true
22
-
=======
23
-
let str1 ="its fleece was white as snow";
24
-
alert(/snow$/.test(str1) ); // true
25
-
>>>>>>> d78b01e9833009fab534462e05c03cffc51bf0e3
26
21
```
27
22
28
23
Nesses casos em particular, poderíamos usar os métodos do objeto string `startsWith/endsWith` em seu lugar. Expressões regulares devem ser usadas para testes mais complexos.
@@ -33,7 +28,7 @@ Frequentemente, ambas as âncoras `pattern:^...$` são usadas juntas para verifi
33
28
34
29
Vamos verificar se uma string é um horário no formato `12:34`. Isto é: dois dígitos, seguido de dois pontos (':'), e então mais dois dígitos.
35
30
36
-
Em expressões regulares, isso fica `pattern:\d\d:\d\d`:
31
+
Em expressões regulares, isso fica `pattern:\d\d:\d\d`:
0 commit comments