Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 28e729b

Browse files
authored
Update solution.md
1 parent 3ed16a5 commit 28e729b

File tree

1 file changed

+8
-8
lines changed
  • 9-regular-expressions/09-regexp-quantifiers/2-find-html-colors-6hex

1 file changed

+8
-8
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
We need to look for `#` followed by 6 hexadecimal characters.
1+
`#` ve ardından 6 onaltılık karakterin gelmesine ihtiyacımız var.
22

3-
A hexadecimal character can be described as `pattern:[0-9a-fA-F]`. Or if we use the `pattern:i` flag, then just `pattern:[0-9a-f]`.
3+
Onaltılık bir karakter `pattern:[0-9a-fA-F]` şeklinde ifade edilebilir. Veya eğer `pattern:i` bayrağını kullanırsak, `pattern:[0-9a-f]` şeklinde ifade edilebilir.
44

5-
Then we can look for 6 of them using the quantifier `pattern:{6}`.
5+
Daha sonrasında `pattern:{6}` nicelik belirtecini kullanarak bunlardan 6 tanesini seçebiliriz.
66

7-
As a result, we have the regexp: `pattern:/#[a-f0-9]{6}/gi`.
7+
Sonuç olarak, `pattern:/#[a-f0-9]{6}/gi` düzenli ifadesine sahibiz.
88

99
```js run
1010
let regexp = /#[a-f0-9]{6}/gi;
@@ -14,18 +14,18 @@ let str = "color:#121212; background-color:#AA00ef bad-colors:f#fddee #fd2"
1414
alert( str.match(regexp) ); // #121212,#AA00ef
1515
```
1616

17-
The problem is that it finds the color in longer sequences:
17+
Buradaki sorun rengi daha uzun dizilerde bulması:
1818

1919
```js run
2020
alert( "#12345678".match( /#[a-f0-9]{6}/gi ) ) // #12345678
2121
```
2222

23-
To fix that, we can add `pattern:\b` to the end:
23+
Bunu çözmek için, sona `pattern:\b` ekleyebiliriz:
2424

2525
```js run
26-
// color
26+
// renk
2727
alert( "#123456".match( /#[a-f0-9]{6}\b/gi ) ); // #123456
2828

29-
// not a color
29+
// bir renk değil
3030
alert( "#12345678".match( /#[a-f0-9]{6}\b/gi ) ); // null
3131
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /