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
Bu bir dize alır, bir alfanümerik kelime tarafından izlenen tüm sayı geçişlerini bulur ve o türdeki her sayıdan bir eksik dize döndürür.
540
+
Bu bir dize alır, bir alfasayısal kelime tarafından izlenen tüm sayı geçişlerini bulur ve o türdeki her sayıdan bir eksik dize döndürür.
541
541
542
542
`(\d+)` grubu, fonksiyona `amount` argümanı olarak gelir ve `(\p{L}+)` grubu `unit` olarak gelir. Fonksiyon, `amount`'u bir sayıya dönüştürür -her zaman `\d+` ile eşleştiğinden- ve yalnızca bir veya sıfır kaldığında bazı ayarlamalar yapar.
Regular expressions are objects that represent patterns in strings. They use their own language to express these patterns.
828
+
Düzenli ifadeler, dizelerdeki kalıpları temsil eden nesnelerdir. Bu kalıpları ifade etmek için kendi dillerini kullanırlar.
829
829
830
830
{{table {cols: [1, 5]}}}
831
831
832
-
| `/abc/` | A sequence of characters
833
-
| `/[abc]/` | Any character from a set of characters
834
-
| `/[^abc]/` | Any character _not_ in a set of characters
835
-
| `/[0-9]/` | Any character in a range of characters
836
-
| `/x+/` | One or more occurrences of the pattern `x`
837
-
| `/x+?/` | One or more occurrences, nongreedy
838
-
| `/x*/` | Zero or more occurrences
839
-
| `/x?/` | Zero or one occurrence
840
-
| `/x{2,4}/` | Two to four occurrences
841
-
| `/(abc)/` | A group
842
-
| `/a|b|c/` | Any one of several patterns
843
-
| `/\d/` | Any digit character
844
-
| `/\w/` | An alphanumeric character ("word character")
845
-
| `/\s/` | Any whitespace character
846
-
| `/./` | Any character except newlines
847
-
| `/\p{L}/u` | Any letter character
848
-
| `/^/` | Start of input
849
-
| `/$/` | End of input
850
-
| `/(?=a)/` | A look-ahead test
832
+
| `/abc/` | Bir dizi karakter
833
+
| `/[abc]/` | Bir dizi karakterden herhangi bir karakter
834
+
| `/[^abc]/` | Bir karakter kümesinde _olmayan_ herhangi bir karakter
835
+
| `/[0-9]/` | Belirli bir karakter aralığındaki herhangi bir karakter
836
+
| `/x+/` | `'x'` kalıbının bir veya daha fazla tekrarı
837
+
| `/x+?/` | 'x'` kalıbının açgözlü olmayan bir veya daha fazla belirişi
838
+
| `/x*/` | Sıfır veya daha fazla beliriş
839
+
| `/x?/` | Sıfır veya bir beliriş
840
+
| `/x{2,4}/` | İkiden dörde kadar beliriş
841
+
| `/(abc)/` | Bir grup
842
+
| `/a|b|c/` | Kalıplardan bir tanesi
843
+
| `/\d/` | Herhangi bir rakam karakteri
844
+
| `/\w/` | Alfasayısal bir karakter ("kelime karakteri")
845
+
| `/\s/` | Herhangi bir boşluk karakteri
846
+
| `/./` | Yeni satır dışında herhangi bir karakter
847
+
| `/\p{L}/u` | Herhangi bir harf karakter
848
+
| `/^/` | Girdi başlangıcı
849
+
| `/$/` | Girdi sonu
850
+
| `/(?=a)/` | İleri görüşlü bir test
851
851
852
-
A regular expression has a method `test` to test whether a given string matches it. It also has a method `exec` that, when a match is found, returns an array containing all matched groups. Such an array has an `index`property that indicates where the match started.
852
+
Düzenli ifade, verilen bir dizenin onunla eşleşip eşleşmediğini test etmek için `test` metoduna sahiptir. Ayrıca, bir eşleşme bulunduğunda, tüm eşleşen grupları içeren bir dizi döndüren `exec` adında bir metod da vardır. Böyle bir dizi, eşleşmenin nerede başladığını gösteren bir `index`özelliğine sahiptir.
853
853
854
-
Strings have a `match`method to match them against a regular expression and a`search`method to search for one, returning only the starting position of the match. Their`replace`method can replace matches of a pattern with a replacement string or function.
854
+
Düzenli ifadeyle dizeleri eşleştirmek için dizelerin bir `match`metodu ve sadece eşleşmenin başlangıç pozisyonunu arayıp döndürmek için bir`search`metodu vardır. Onların`replace`metodu, bir desenin eşleşmelerini bir değiştirme dizesi veya fonksiyonu ile değiştirebilir.
855
855
856
-
Regular expressions can have options, which are written after the closing slash. The `i`option makes the match case insensitive. The `g`option makes the expression _global_, which, among other things, causes the `replace`method to replace all instances instead of just the first. The `y`option makes it sticky, which means that it will not search ahead and skip part of the string when looking for a match. The `u`option turns on Unicode mode, which enables`\p`syntax and fixes a number of problems around the handling of characters that take up two code units.
856
+
Düzenli ifadelerin seçenekleri olabilir, bunlar kapatma eğik çizgi sonrasına yazılır. `i`seçeneği, eşleşmenin harf büyüklüğüne duyarsız yapar. `g`seçeneği ifadeyi global yapar, bu da `replace`metodunun yalnızca ilk eşleşen dize yerine tüm eşleşen dize parçalarının değiştirmesine neden olur. `y`seçeneği yapışkandır, bu da bir eşleşme ararken bir dizenin bir kısmını önemsizce atlamayıp teker teker arayacağı anlamına gelir. `u`seçeneği Unicode modunu açar, bu da`\p`sözdizimini etkinleştirir ve iki kod birimini alan karakterlerin işlenmesindeki oluşan bir takım sorunları düzeltir.
857
857
858
-
Regular expressions are a sharp ((tool)) with an awkward handle. They simplify some tasks tremendously but can quickly become unmanageable when applied to complex problems. Part of knowing how to use them is resisting the urge to try to shoehorn things that they cannot cleanly express into them.
858
+
Düzenli ifadeler, garip bir sapı olan keskin bir ((araç))tır. Bazı görevleri büyük ölçüde basitleştirirler ancak karmaşık sorunlara uygulandığında hızla yönetilemez hale gelebilirler. Onları nasıl kullanacağınızın bir parçası, temiz bir şekilde ifade edemeyecekleri şeyleri zorla onlara sokuşturma dürtüsüne karşı koymaktır.
859
859
860
-
## Exercises
860
+
## Egzersizler
861
861
862
862
{{index debugging, bug}}
863
863
864
-
It is almost unavoidable that, in the course of working on these exercises, you will get confused and frustrated by some regular expression's inexplicable ((behavior)). Sometimes it helps to enter your expression into an online tool like [_debuggex.com_](https://www.debuggex.com/)to see whether its visualization corresponds to what you intended and to ((experiment)) with the way it responds to various input strings.
864
+
Bu alıştırmalar üzerinde çalışırken, bazı düzenli ifadelerin açıklanamayan ((davranış))ları tarafından kafa karışıklığına uğrayacağınız ve bunlardan bazıları tarafından hızla sinirleneceğiniz neredeyse kaçınılmazdır. Bazen, ifadenizi [_debuggex.com_](https://www.debuggex.com/)gibi çevrimiçi bir araca girerek, oluşturduğu görselleştirmenin istediğiniz şeyle uyuşup uyuşmadığını görmek ve çeşitli giriş dizelerine nasıl yanıt verdiğini test etmek yardımcı olabilir.
_Code golf_ is a term used for the game of trying to express a particular program in as few characters as possible. Similarly, _regexp golf_ is the practice of writing as tiny a regular expression as possible to match a given pattern, and _only_ that pattern.
870
+
_Kod golfü_, belirli bir programı mümkün olduğunca az karakterle ifade etme oyunu için kullanılan bir terimdir. Benzer şekilde, _düzenli ifade golfü_, _yalnızca_ verilen o deseni eşleştirmek için mümkün olduğunca küçük bir düzenli ifade yazma uygulamasıdır.
871
871
872
872
{{index boundary, matching}}
873
873
874
-
For each of the following items, write a ((regular expression)) to test whether the given pattern occurs in a string. The regular expression should match only strings containing the pattern. When your expression works, see whether you can make it any smaller.
874
+
Aşağıdaki her öğe için, verilen desenin bir dizide olup olmadığını test etmek için bir ((düzenli ifade)) yazın. Düzenli ifade, yalnızca deseni içeren dizeleri eşleştirmelidir. İfadeniz çalıştığında, onu daha da küçültebilme ihtimaliniz üzerine düşünün.
875
875
876
-
1._car_and_cat_
877
-
2._pop_and_prop_
878
-
3._ferret_, _ferry_, and_ferrari_
879
-
4.Any word ending in _ious_
880
-
5.A whitespace character followed by a period, comma, colon, or semicolon
881
-
6.A word longer than six letters
882
-
7.A word without the letter _e_ (or_E_)
876
+
1._car_ve_cat_
877
+
2._pop_ve_prop_
878
+
3._ferret_, _ferry_, ve_ferrari_
879
+
4._ious_ ile biten herhangi bir kelime
880
+
5.Bir boşluk karakteri ve ardından nokta, virgül, iki nokta üst üste veya noktalı virgül gelen bir dize
881
+
6.Altı harften uzun bir kelime
882
+
7._e_ (veya_E_) harfi olmayan bir kelime
883
883
884
-
Refer to the table in the [chapter summary](regexp#summary_regexp)for help. Test each solution with a few test strings.
884
+
Yardım için [bölüm özeti](regexp#summary_regexp)içindeki tabloya bakın. Her çözümü birkaç test dizisiyle test edin.
885
885
886
886
{{if interactive
887
887
```
888
-
// Fill in the regular expressions
888
+
// Düzenli ifadeleri doldurun
889
889
890
890
verify(/.../,
891
891
["my car", "bad cats"],
@@ -930,20 +930,20 @@ function verify(regexp, yes, no) {
Imagine you have written a story and used single ((quotation mark))s throughout to mark pieces of dialogue. Now you want to replace all the dialogue quotes with double quotes, while keeping the single quotes used in contractions like _aren't_.
937
+
Bir hikaye yazdınızı ve diyalog parçalarını işaretlemek için tümüyle tek ((tırnak işareti)) kullandığınızı hayal edin. Şimdi, _aren't_ gibi kısaltmalarda kullanılan tek tırnakları koruyarak tüm diyalog alıntılarını çift tırnaklarla değiştirmek istiyorsunuz.
938
938
939
939
{{index "replace method"}}
940
940
941
-
Think of a pattern that distinguishes these two kinds of quote usage and craft a call to the `replace`method that does the proper replacement.
941
+
Bu iki tür tırnak kullanımını ayıran bir desen düşünün ve doğru değiştirmeyi yapacak `replace`metoduna bir çağrı oluşturun.
942
942
943
943
{{if interactive
944
944
```{test: no}
945
945
let text = "'I'm the cook,' he said, 'it's my job.'";
946
-
// Change this call.
946
+
// Bu çağrıyı değiştir.
947
947
console.log(text.replace(/A/g, "B"));
948
948
// → "I'm the cook," he said, "it's my job."
949
949
```
@@ -953,23 +953,23 @@ if}}
953
953
954
954
{{index "quoting style (exercise)", boundary}}
955
955
956
-
The most obvious solution is to replace only quotes with a nonletter character on at least one side—something like `/\P{L}'|'\P{L}/`. But you also have to take the start and end of the line into account.
956
+
En açık çözüm, en az bir tarafında harf olmayan tırnakları değiştirmektir - `/\P{L}'|'\P{L}/` gibi bir şey. Ancak, satırın başlangıcını ve sonunu da dikkate almalısınız.
957
957
958
958
{{index grouping, "replace method", [parentheses, "in regular expressions"]}}
959
959
960
-
In addition, you must ensure that the replacement also includes the characters that were matched by the `\P{L}`pattern so that those are not dropped. This can be done by wrapping them in parentheses and including their groups in the replacement string (`$1`, `$2`). Groups that are not matched will be replaced by nothing.
960
+
Ek olarak, değiştirmenin, `\P{L}`deseniyle eşleşen karakterleri de içermesini sağlamalısınız ki bunlar düşürülmesin. Bunun yapılması, parantez içine alarak ve değiştirme dizesine gruplarını (`$1`, `$2`) dahil ederek yapılabilir. Eşleşmeyen gruplar hiçbir şey ile değiştirilecektir.
Write an expression that matches only JavaScript-style ((number))s. It must support an optional minus _or_ plus sign in front of the number, the decimal dot, and exponent notation—`5e-3`or`1E10`—again with an optional sign in front of the exponent. Also note that it is not necessary for there to be digits in front of or after the dot, but the number cannot be a dot alone. That is, `.5`and`5.`are valid JavaScript numbers, but a lone dot _isn't_.
968
+
Sadece JavaScript tarzı ((sayı))ları eşleştiren bir ifade yazın. Sayının önünde isteğe bağlı eksi _veya_ artı işareti, ondalık nokta ve üstel gösterim - `5e-3`veya`1E10` - yine üstel önünde isteğe bağlı bir işaret ile desteklenmelidir. Ayrıca, noktanın önünde veya sonra rakamlar olması gerekli değildir, ancak sayı yalnızca bir nokta olamaz. Yani, `.5`ve`5.`geçerli JavaScript sayılarıdır, ancak yalnızca nokta _değildir_.
969
969
970
970
{{if interactive
971
971
```{test: no}
972
-
// Fill in this regular expression.
972
+
// Bu düzenli ifadeyi doldurun.
973
973
let number = /^...$/;
974
974
975
975
// Tests:
@@ -993,16 +993,16 @@ if}}
993
993
994
994
{{index ["regular expression", escaping], ["backslash character", "in regular expressions"]}}
995
995
996
-
First, do not forget the backslash in front of the period.
996
+
Öncelikle noktanın önüne ters eğik çizgi koymayı unutmayın.
997
997
998
-
Matching the optional ((sign)) in front of the ((number)), as well as in front of the ((exponent)), can be done with `[+\-]?`or`(\+|-|)` (plus, minus, or nothing).
998
+
Sayının önündeki isteğe bağlı ((işaret)) ile, aynı zamanda önündeki üstel işareti eşleştirmek `[+\-]?`veya`(\+|-|)` (artı, eksi veya hiçbir şey) aracılığıyla yapılabilir.
999
999
1000
1000
{{index "pipe character"}}
1001
1001
1002
-
The more complicated part of the exercise is the problem of matching both `"5."`and`".5"`without also matching `"."`. For this, a good solution is to use the `|`operator to separate the two cases—either one or more digits optionally followed by a dot and zero or more digits _or_ a dot followed by one or more digits.
1002
+
Bu alıştırmanın daha karmaşık kısmı, `"5."`ve`".5"`dizelerini eşleştirirken `"."` dizesini eşleştirmemektir. Bu iki durumu ayırmak için `|`operatörünü kullanmak iyi bir çözümdür - ya bir veya daha fazla rakamın, isteğe bağlı olarak bir noktayla devam etmesi ve sıfır veya daha fazla rakamın ardından gelmesi _veya_ bir noktanın bir veya daha fazla rakamdan sonra geldiği durum.
0 commit comments