Add languages Russian, Arabic, Chinese, Portuguese (#18305)

This commit is contained in:
Beau Carnes
2018-10-10 18:03:03 -04:00
committed by mrugesh mohapatra
parent 09d3eca712
commit 2ca3a2093f
5517 changed files with 371466 additions and 5 deletions

View File

@ -0,0 +1,57 @@
---
id: 587d7dba367417b2b2512ba8
title: Check for All or None
challengeType: 1
videoUrl: ''
localeTitle: تحقق من الكل أو لا شيء
---
## Description
<section id="description"> في بعض الأحيان قد تحتوي الأنماط التي تريد البحث عنها على أجزاء منها قد تكون موجودة أو غير موجودة. ومع ذلك ، قد يكون من المهم التحقق منهم على الرغم من ذلك. يمكنك تحديد الوجود المحتمل لعنصر مع علامة استفهام ، <code>?</code> . هذا يتحقق لصفر أو واحد من العنصر السابق. يمكنك التفكير في هذا الرمز كقول أن العنصر السابق اختياري. على سبيل المثال ، هناك اختلافات طفيفة في اللغة الإنجليزية الأمريكية والبريطانية ويمكنك استخدام علامة الاستفهام لمطابقة كل من التهجئة. <blockquote style=";text-align:right;direction:rtl"> دع أمريكا = &quot;لون&quot; ؛ <br> دعونا البريطانية = &quot;لون&quot;. <br> اترك rainbowRegex = / colou؟ r /؛ <br> rainbowRegex.test (أمريكا)؛ // يعود صحيح <br> rainbowRegex.test (البريطانية)؛ // يعود صحيح </blockquote></section>
## Instructions
<section id="instructions"> قم بتغيير <code>favRegex</code> regex لمطابقة كل من الإنجليزية الأمريكية (المفضلة) وإصدار اللغة الإنجليزية البريطانية (المفضلة) للكلمة. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك العادي الرمز الاختياري ، <code>?</code> .
testString: 'assert(favRegex.source.match(/\?/).length > 0, "Your regex should use the optional symbol, <code>?</code>.");'
- text: يجب أن يتطابق التعبير العادي مع <code>&quot;favorite&quot;</code>
testString: 'assert(favRegex.test("favorite"), "Your regex should match <code>"favorite"</code>");'
- text: يجب أن يتطابق التعبير العادي مع <code>&quot;favourite&quot;</code>
testString: 'assert(favRegex.test("favourite"), "Your regex should match <code>"favourite"</code>");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>&quot;fav&quot;</code>
testString: 'assert(!favRegex.test("fav"), "Your regex should not match <code>"fav"</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let favWord = "favorite";
let favRegex = /change/; // Change this line
let result = favRegex.test(favWord);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 587d7db4367417b2b2512b92
title: Extract Matches
challengeType: 1
videoUrl: ''
localeTitle: استخراج مباريات
---
## Description
<section id="description"> حتى الآن ، كنت تتحقق فقط مما إذا كان هناك نمط موجود أم لا داخل سلسلة. يمكنك أيضًا استخراج التطابقات الفعلية التي وجدتها مع طريقة <code>.match()</code> . لاستخدام طريقة <code>.match()</code> ، قم بتطبيق الطريقة على سلسلة وتمريرها في regex داخل الأقواس. إليك مثال على ذلك: <blockquote style=";text-align:right;direction:rtl"> &quot;مرحبا ، العالم!&quot;. المباراة (/ مرحبا /) ؛ <br> // إرجاع [&quot;مرحبًا&quot;] <br> دع ourStr = &quot;التعبيرات العادية&quot;؛ <br> اسمحوا ourRegex = / تعبيرات / ؛ <br> ourStr.match (ourRegex)؛ <br> // إرجاع [&quot;التعبيرات&quot;] </blockquote></section>
## Instructions
<section id="instructions"> قم <code>.match()</code> طريقة <code>.match()</code> لاستخراج كلمة <code>coding</code> . </section>
## Tests
<section id='tests'>
```yml
tests:
- text: و <code>result</code> يجب أن يكون كلمة <code>coding</code>
testString: 'assert(result.join() === "coding", "The <code>result</code> should have the word <code>coding</code>");'
- text: يجب أن يبحث <code>codingRegex</code> regex <code>codingRegex</code> عن <code>coding</code>
testString: 'assert(codingRegex.source === "coding", "Your regex <code>codingRegex</code> should search for <code>coding</code>");'
- text: يجب عليك استخدام طريقة <code>.match()</code> .
testString: 'assert(code.match(/\.match\(.*\)/), "You should use the <code>.match()</code> method.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let extractStr = "Extract the word 'coding' from this string.";
let codingRegex = /change/; // Change this line
let result = extractStr; // Change this line
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,51 @@
---
id: 587d7db6367417b2b2512b9b
title: Find Characters with Lazy Matching
challengeType: 1
videoUrl: ''
localeTitle: العثور على شخصيات مع مطابقة كسول
---
## Description
<section id="description"> في التعبيرات العادية ، تعثر المطابقة <code>greedy</code> على أطول جزء ممكن من السلسلة التي تناسب نمط regex وتعرضها كمطابقة. ويطلق على البديل اسم &quot;مطابقة <code>lazy</code> ، والتي تجد أصغر جزء ممكن من السلسلة التي تفي بنمط regex. يمكنك تطبيق regex <code>/t[az]*i/</code> على السلسلة <code>&quot;titanic&quot;</code> . هذا التعبير المعتاد هو في الأساس نمط يبدأ بـ <code>t</code> ، وينتهي بـ <code>i</code> ، ويحتوي على بعض الأحرف بينهما. تكون التعابير العادية <code>greedy</code> بشكل افتراضي ، لذا فإن المباراة ستعيد <code>[&quot;titani&quot;]</code> . يجد أكبر سلسلة فرعية ممكنة لتناسب النمط. ومع ذلك ، يمكنك استخدام <code>?</code> شخصية لتغييره إلى مطابقة <code>lazy</code> . تطابق <code>&quot;titanic&quot;</code> مع regex المعدلة من <code>/t[az]*?i/</code> returns <code>[&quot;ti&quot;]</code> . </section>
## Instructions
<section id="instructions"> أصلح regex <code>/&lt;.*&gt;/</code> لإرجاع علامة HTML <code>&lt;h1&gt;</code> وليس النص <code>&quot;&lt;h1&gt;Winter is coming&lt;/h1&gt;&quot;</code> . تذكر حرف البدل <code>.</code> في التعبير العادي يطابق أي حرف. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يكون متغير <code>result</code> صفيفًا به <code>&lt;h1&gt;</code> فيه
testString: 'assert(result[0] == "<h1>", "The <code>result</code> variable should be an array with <code>&lt;h1&gt;</code> in it");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let text = "<h1>Winter is coming</h1>";
let myRegex = /<.*>/; // Change this line
let result = text.match(myRegex);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,57 @@
---
id: 587d7db4367417b2b2512b93
title: Find More Than the First Match
challengeType: 1
videoUrl: ''
localeTitle: العثور على أكثر من المباراة الأولى
---
## Description
<section id="description"> حتى الآن ، كنت قادرًا على استخراج نمط أو البحث عنه مرة واحدة فقط. <blockquote style=";text-align:right;direction:rtl"> let testStr = &quot;Repeat، Repeat، Repeat&quot;؛ <br> دع ourRegex = / كرر /؛ <br> testStr.match (ourRegex)؛ <br> // Returns [&quot;Repeat&quot;] </blockquote> للبحث أو استخراج نمط أكثر من مرة ، يمكنك استخدام علم <code>g</code> . <blockquote style=";text-align:right;direction:rtl"> اترك repeatRegex = / Repeat / g؛ <br> testStr.match (repeatRegex)؛ <br> // Returns [&quot;Repeat&quot;، &quot;Repeat&quot;، &quot;Repeat&quot;] </blockquote></section>
## Instructions
<section id="instructions"> باستخدام regex <code>starRegex</code> ، ابحث <code>starRegex</code> الكلمات <code>&quot;Twinkle&quot;</code> من سلسلة <code>twinkleStar</code> . <strong>ملحوظة</strong> <br> يمكنك الحصول على العديد من العلامات على تعديلك مثل <code>/search/gi</code> </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم <code>starRegex</code> regex الخاص بك العلم العالمي <code>g</code>
testString: 'assert(starRegex.flags.match(/g/).length == 1, "Your regex <code>starRegex</code> should use the global flag <code>g</code>");'
- text: يجب أن يستخدم <code>starRegex</code> الخاص بك regex <code>starRegex</code> الحالة غير الحساسة <code>i</code>
testString: 'assert(starRegex.flags.match(/i/).length == 1, "Your regex <code>starRegex</code> should use the case insensitive flag <code>i</code>");'
- text: يجب أن تتطابق المطابقة مع كلمتين لكلمة <code>&quot;Twinkle&quot;</code>
testString: 'assert(result.sort().join() == twinkleStar.match(/twinkle/gi).sort().join(), "Your match should match both occurrences of the word <code>"Twinkle"</code>");'
- text: يجب أن تحتوي <code>result</code> المطابقة الخاصة بك على عنصرين.
testString: 'assert(result.length == 2, "Your match <code>result</code> should have two elements in it.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let twinkleStar = "Twinkle, twinkle, little star";
let starRegex = /change/; // Change this line
let result = twinkleStar; // Change this line
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,67 @@
---
id: 587d7db7367417b2b2512b9c
title: Find One or More Criminals in a Hunt
challengeType: 1
videoUrl: ''
localeTitle: العثور على واحد أو أكثر من المجرمين في مطاردة
---
## Description
<section id="description"> حان وقت الإيقاف المؤقت واختبار مهاراتك الجديدة في الكتابة المعتادة. هربت مجموعة من المجرمين من السجن وهربت ، لكنك لا تعرف عددهم. ومع ذلك ، فأنت تعرف أنها تبقى قريبة من بعضها البعض عندما تكون حول أشخاص آخرين. أنت مسؤول عن العثور على جميع المجرمين في وقت واحد. في ما يلي مثال لمراجعة كيفية إجراء ذلك: يطابق regex <code>/z+/</code> الحرف <code>z</code> عند ظهوره مرة واحدة أو أكثر في صف واحد. سيجد تطابقات في كافة السلاسل التالية: <blockquote style=";text-align:right;direction:rtl"> &quot;ض&quot; <br> &quot;zzzzzz&quot; <br> &quot;ABCzzzz&quot; <br> &quot;zzzzABC&quot; <br> &quot;abczzzzzzzzzzzzzzzzzzzzzabc&quot; </blockquote> ولكنه لا يعثر على تطابقات في السلاسل التالية حيث لا توجد أحرف <code>z</code> حرف: <blockquote style=";text-align:right;direction:rtl"> &quot;&quot; <br> &quot;ABC&quot; <br> &quot;ABCABC&quot; </blockquote></section>
## Instructions
<section id="instructions"> اكتب regex <code>greedy</code> أن يجد واحد أو أكثر من المجرمين داخل مجموعة من الناس الآخرين. يمثل المجرم بالحرف الكبير <code>C</code> </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يتطابق تعبيرك العادي مع <code>one</code> المجرمين (&quot; <code>C</code> &quot;) في <code>&quot;C&quot;</code>
testString: 'assert("C".match(reCriminals) && "C".match(reCriminals)[0] == "C", "Your regex should match <code>one</code> criminal ("<code>C</code>") in <code>"C"</code>");'
- text: يجب أن يتطابق تعبيرك العادي مع <code>two</code> المجرمين (&quot; <code>CC</code> &quot;) في <code>&quot;CC&quot;</code>
testString: 'assert("CC".match(reCriminals) && "CC".match(reCriminals)[0] == "CC", "Your regex should match <code>two</code> criminals ("<code>CC</code>") in <code>"CC"</code>");'
- text: يجب أن يتطابق <code>&quot;P1P5P4CCCP2P6P3&quot;</code> العادي مع <code>three</code> مجرمين (&quot; <code>CCC</code> &quot;) في <code>&quot;P1P5P4CCCP2P6P3&quot;</code>
testString: 'assert("P1P5P4CCCP2P6P3".match(reCriminals) && "P1P5P4CCCP2P6P3".match(reCriminals)[0] == "CCC", "Your regex should match <code>three</code> criminals ("<code>CCC</code>") in <code>"P1P5P4CCCP2P6P3"</code>");'
- text: يجب أن يتطابق <code>&quot;P6P2P7P4P5CCCCCP3P1&quot;</code> العادي مع <code>five</code> مجرمين (&quot; <code>CCCCC</code> &quot;) في <code>&quot;P6P2P7P4P5CCCCCP3P1&quot;</code>
testString: 'assert("P6P2P7P4P5CCCCCP3P1".match(reCriminals) && "P6P2P7P4P5CCCCCP3P1".match(reCriminals)[0] == "CCCCC", "Your regex should match <code>five</code> criminals ("<code>CCCCC</code>") in <code>"P6P2P7P4P5CCCCCP3P1"</code>");'
- text: يجب ألا يتطابق تعبيرك العادي مع أي مجرمين في <code>&quot;&quot;</code>
testString: 'assert(!reCriminals.test(""), "Your regex should not match any criminals in <code>""</code>");'
- text: يجب ألا يتطابق <code>&quot;P1P2P3&quot;</code> العادي مع أي مجرمين في <code>&quot;P1P2P3&quot;</code>
testString: 'assert(!reCriminals.test("P1P2P3"), "Your regex should not match any criminals in <code>"P1P2P3"</code>");'
- text: يجب أن يتطابق <code>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</code> العادي مع <code>fifty</code> المجرمين (&quot; <code>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</code> &quot;) في <code>&quot;P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3&quot;</code> .
testString: 'assert("P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3".match(reCriminals) && "P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3".match(reCriminals)[0] == "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", "Your regex should match <code>fifty</code> criminals ("<code>CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC</code>") in <code>"P2P1P5P4CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCP3"</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
// example crowd gathering
let crowd = 'P1P2P3P4P5P6CCCP7P8P9';
let reCriminals = /./; // Change this line
let matchedCriminals = crowd.match(reCriminals);
console.log(matchedCriminals);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,69 @@
---
id: 587d7db4367417b2b2512b91
title: Ignore Case While Matching
challengeType: 1
videoUrl: ''
localeTitle: تجاهل حالة أثناء المطابقة
---
## Description
<section id="description"> حتى الآن ، كنت قد نظرت في regexes للقيام مباريات حرفية من السلاسل. لكن في بعض الأحيان ، قد ترغب أيضًا في مطابقة اختلافات الحالات. الحالة (أو في بعض الأحيان حالة الأحرف) هي الفرق بين الأحرف الكبيرة والأحرف الصغيرة. أمثلة من الأحرف الكبيرة هي <code>&quot;A&quot;</code> و <code>&quot;B&quot;</code> و <code>&quot;C&quot;</code> . أمثلة من الأحرف الصغيرة هي <code>&quot;a&quot;</code> و <code>&quot;b&quot;</code> و <code>&quot;c&quot;</code> . يمكنك مطابقة الحالتين باستخدام ما يسمى بعلم. هناك علامات أخرى ولكن هنا سوف تركز على العلم الذي يتجاهل القضية - العلم <code>i</code> . يمكنك استخدامه عن طريق إلحاقه بالتعبير المعتاد. مثال على استخدام هذه العلامة هو <code>/ignorecase/i</code> . يمكن أن يتطابق هذا التعبير المعتاد مع الجمل <code>&quot;ignorecase&quot;</code> و <code>&quot;igNoreCase&quot;</code> و <code>&quot;IgnoreCase&quot;</code> . </section>
## Instructions
<section id="instructions"> اكتب <code>fccRegex</code> regex لمطابقة <code>&quot;freeCodeCamp&quot;</code> ، بغض النظر عن قضيته. يجب ألا يتطابق تعبيرك العادي مع أي اختصارات أو اختلافات في المساحات. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يتطابق <code>freeCodeCamp</code> العادي مع <code>freeCodeCamp</code>
testString: 'assert(fccRegex.test("freeCodeCamp"), "Your regex should match <code>freeCodeCamp</code>");'
- text: يجب أن يتطابق <code>FreeCodeCamp</code> العادي مع <code>FreeCodeCamp</code>
testString: 'assert(fccRegex.test("FreeCodeCamp"), "Your regex should match <code>FreeCodeCamp</code>");'
- text: يجب أن يتطابق <code>FreecodeCamp</code> العادي مع <code>FreecodeCamp</code>
testString: 'assert(fccRegex.test("FreecodeCamp"), "Your regex should match <code>FreecodeCamp</code>");'
- text: يجب أن يتطابق <code>FreeCodecamp</code> العادي مع <code>FreeCodecamp</code>
testString: 'assert(fccRegex.test("FreeCodecamp"), "Your regex should match <code>FreeCodecamp</code>");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>Free Code Camp</code>
testString: 'assert(!fccRegex.test("Free Code Camp"), "Your regex should not match <code>Free Code Camp</code>");'
- text: يجب أن يتطابق <code>FreeCOdeCamp</code> العادي مع <code>FreeCOdeCamp</code>
testString: 'assert(fccRegex.test("FreeCOdeCamp"), "Your regex should match <code>FreeCOdeCamp</code>");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>FCC</code>
testString: 'assert(!fccRegex.test("FCC"), "Your regex should not match <code>FCC</code>");'
- text: يجب أن يتطابق <code>FrEeCoDeCamp</code> العادي مع <code>FrEeCoDeCamp</code>
testString: 'assert(fccRegex.test("FrEeCoDeCamp"), "Your regex should match <code>FrEeCoDeCamp</code>");'
- text: يجب أن يتطابق <code>FrEeCodECamp</code> العادي مع <code>FrEeCodECamp</code>
testString: 'assert(fccRegex.test("FrEeCodECamp"), "Your regex should match <code>FrEeCodECamp</code>");'
- text: يجب أن يتطابق التعبير المعتاد مع <code>FReeCodeCAmp</code>
testString: 'assert(fccRegex.test("FReeCodeCAmp"), "Your regex should match <code>FReeCodeCAmp</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let myString = "freeCodeCamp";
let fccRegex = /change/; // Change this line
let result = fccRegex.test(myString);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,63 @@
---
id: 587d7db4367417b2b2512b90
title: Match a Literal String with Different Possibilities
challengeType: 1
videoUrl: ''
localeTitle: تطابق سلسلة حرفية مع الاحتمالات المختلفة
---
## Description
<section id="description"> باستخدام regexes مثل <code>/coding/</code> ، يمكنك البحث عن نمط <code>&quot;coding&quot;</code> في سلسلة أخرى. يعد هذا أمرًا قويًا للبحث عن سلاسل مفردة ، ولكنه يقتصر على نمط واحد فقط. يمكنك البحث عن أنماط متعددة باستخدام <code>alternation</code> أو <code>OR</code> المشغل: <code>|</code> . هذا المشغل يطابق الأنماط قبل أو بعدها. على سبيل المثال ، إذا كنت تريد مطابقة <code>&quot;yes&quot;</code> أو <code>&quot;no&quot;</code> ، فإن التعبير المعتاد الذي تريده هو <code>/yes|no/</code> . يمكنك أيضًا البحث عن أكثر من نمطين فقط. يمكنك القيام بذلك عن طريق إضافة المزيد من الأنماط مع المزيد من عوامل تشغيل <code>OR</code> تفصل بينها ، مثل <code>/yes|no|maybe/</code> . </section>
## Instructions
<section id="instructions"> أكمل <code>petRegex</code> regex <code>petRegex</code> مع الحيوانات الأليفة <code>&quot;dog&quot;</code> أو <code>&quot;cat&quot;</code> أو <code>&quot;bird&quot;</code> أو <code>&quot;fish&quot;</code> . </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب إرجاع <code>petRegex</code> الخاص بك regex <code>true</code> للسلسلة <code>&quot;John has a pet dog.&quot;</code>
testString: 'assert(petRegex.test("John has a pet dog."), "Your regex <code>petRegex</code> should return <code>true</code> for the string <code>"John has a pet dog."</code>");'
- text: يجب إرجاع <code>petRegex</code> الخاص بك regex <code>false</code> لسلسلة <code>&quot;Emma has a pet rock.&quot;</code>
testString: 'assert(!petRegex.test("Emma has a pet rock."), "Your regex <code>petRegex</code> should return <code>false</code> for the string <code>"Emma has a pet rock."</code>");'
- text: يجب إرجاع <code>petRegex</code> الخاص بك regex <code>true</code> للسلسلة <code>&quot;Emma has a pet bird.&quot;</code>
testString: 'assert(petRegex.test("Emma has a pet bird."), "Your regex <code>petRegex</code> should return <code>true</code> for the string <code>"Emma has a pet bird."</code>");'
- text: يجب إعادة <code>petRegex</code> الخاص بك regex <code>true</code> للسلسلة <code>&quot;Liz has a pet cat.&quot;</code>
testString: 'assert(petRegex.test("Liz has a pet cat."), "Your regex <code>petRegex</code> should return <code>true</code> for the string <code>"Liz has a pet cat."</code>");'
- text: يجب إعادة <code>petRegex</code> الخاص بك regex <code>false</code> للسلسلة <code>&quot;Kara has a pet dolphin.&quot;</code> <code>petRegex</code> <code>&quot;Kara has a pet dolphin.&quot;</code>
testString: 'assert(!petRegex.test("Kara has a pet dolphin."), "Your regex <code>petRegex</code> should return <code>false</code> for the string <code>"Kara has a pet dolphin."</code>");'
- text: يجب أن يعود <code>petRegex</code> المعتاد الخاص بك <code>true</code> للسلسلة <code>&quot;Alice has a pet fish.&quot;</code>
testString: 'assert(petRegex.test("Alice has a pet fish."), "Your regex <code>petRegex</code> should return <code>true</code> for the string <code>"Alice has a pet fish."</code>");'
- text: يجب أن <code>petRegex</code> المعتاد الخاص بك <code>false</code> للسلسلة <code>&quot;Jimmy has a pet computer.&quot;</code>
testString: 'assert(!petRegex.test("Jimmy has a pet computer."), "Your regex <code>petRegex</code> should return <code>false</code> for the string <code>"Jimmy has a pet computer."</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let petString = "James has a pet cat.";
let petRegex = /change/; // Change this line
let result = petRegex.test(petString);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: 587d7db7367417b2b2512b9f
title: Match All Letters and Numbers
challengeType: 1
videoUrl: ''
localeTitle: المباراة جميع الحروف والأرقام
---
## Description
<section id="description"> باستخدام فئات الأحرف ، تمكنت من البحث عن جميع حروف الأبجدية باستخدام <code>[az]</code> . هذا النوع من فئة الأحرف شائع بما فيه الكفاية أن هناك اختصارًا له ، على الرغم من أنه يتضمن بضعة أحرف إضافية أيضًا. إن أقرب فئة أحرف في JavaScript لتطابق الأبجدية هي <code>\w</code> . هذا الاختصار يساوي <code>[A-Za-z0-9_]</code> . فئة الأحرف هذا تطابق الأحرف الكبيرة والصغيرة بالإضافة إلى الأرقام. ملاحظة ، يتضمن فئة الأحرف هذه أيضًا حرف تسطير أسفل السطر ( <code>_</code> ). <blockquote style=";text-align:right;direction:rtl"> let longHand = / [A-Za-z0-9 _] + /؛ <br> اترك shortHand = / \ w + /؛ <br> السماح للأرقام = &quot;42&quot; ؛ <br> السماح varNames = &quot;important_var&quot; ؛ <br> longHand.test (الأرقام)؛ // يعود صحيح <br> shortHand.test (الأرقام)؛ // يعود صحيح <br> longHand.test (varNames)؛ // يعود صحيح <br> shortHand.test (varNames)؛ // يعود صحيح </blockquote> ومن المعروف أيضا أن هذه الفئات طابع الاختصار كما <code>shorthand character classes</code> . </section>
## Instructions
<section id="instructions"> استخدم class <code>\w</code> حرف الاختصار لحساب عدد الأحرف الأبجدية الرقمية في علامات الاقتباس والسلاسل المختلفة. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك العادي العلم العام.
testString: 'assert(alphabetRegexV2.global, "Your regex should use the global flag.");'
- text: يجب أن يستخدم تعبيرك العادي الحرف المختصر
testString: 'assert(/\\w/.test(alphabetRegexV2.source), "Your regex should use the shorthand character <code>\w</code> to match all characters which are alphanumeric.");'
- text: يجب أن يعثر تعبيرك المنطقي على 31 حرفًا أبجديًا رقميًا في <code>&quot;The five boxing wizards jump quickly.&quot;</code>
testString: 'assert("The five boxing wizards jump quickly.".match(alphabetRegexV2).length === 31, "Your regex should find 31 alphanumeric characters in <code>"The five boxing wizards jump quickly."</code>");'
- text: يجب أن يعثر تعبيرك المنطقي على 32 حرفًا أبجديًا رقميًا في <code>&quot;Pack my box with five dozen liquor jugs.&quot;</code>
testString: 'assert("Pack my box with five dozen liquor jugs.".match(alphabetRegexV2).length === 32, "Your regex should find 32 alphanumeric characters in <code>"Pack my box with five dozen liquor jugs."</code>");'
- text: يجب أن يعثر تعبيرك المعتاد على 30 حرفًا أبجديًا رقميًا في <code>&quot;How vexingly quick daft zebras jump!&quot;</code>
testString: 'assert("How vexingly quick daft zebras jump!".match(alphabetRegexV2).length === 30, "Your regex should find 30 alphanumeric characters in <code>"How vexingly quick daft zebras jump!"</code>");'
- text: يجب أن يعثر <code>&quot;123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.&quot;</code> على 36 حرفًا أبجديًا رقميًا في <code>&quot;123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.&quot;</code>
testString: 'assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(alphabetRegexV2).length === 36, "Your regex should find 36 alphanumeric characters in <code>"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let quoteSample = "The five boxing wizards jump quickly.";
let alphabetRegexV2 = /change/; // Change this line
let result = quoteSample.match(alphabetRegexV2).length;
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,65 @@
---
id: 587d7db8367417b2b2512ba1
title: Match All Non-Numbers
challengeType: 1
videoUrl: ''
localeTitle: المباراة جميع غير الارقام
---
## Description
<section id="description"> أظهر التحدي الأخير كيفية البحث عن الأرقام باستخدام الاختصار <code>\d</code> باستخدام أحرف صغيرة <code>d</code> . يمكنك أيضًا البحث عن غير أرقام باستخدام اختصار مماثل يستخدم حرف <code>D</code> كبيرًا بدلاً من ذلك. الاختصار للبحث عن أحرف غير رقمية هو <code>\D</code> هذا يساوي فئة الأحرف <code>[^0-9]</code> ، والتي تبحث عن حرف واحد ليس رقمًا بين الصفر والتاسع. </section>
## Instructions
<section id="instructions"> استخدم فئة حرف الاختصار غير digits <code>\D</code> لحساب عدد غير أرقام في عناوين الأفلام. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك العادي حرف الاختصار لمطابقة الأحرف غير المكونة
testString: 'assert(/\\D/.test(noNumRegex.source), "Your regex should use the shortcut character to match non-digit characters");'
- text: يجب أن يستخدم تعبيرك العادي العلم العام.
testString: 'assert(noNumRegex.global, "Your regex should use the global flag.");'
- text: يجب ألا يعثر التعبير المعتاد على أي أرقام في <code>&quot;9&quot;</code> .
testString: 'assert("9".match(noNumRegex) == null, "Your regex should find no non-digits in <code>"9"</code>.");'
- text: يجب أن يعثر تعبيرك المنطقي على 6 أرقام في <code>&quot;Catch 22&quot;</code> .
testString: 'assert("Catch 22".match(noNumRegex).length == 6, "Your regex should find 6 non-digits in <code>"Catch 22"</code>.");'
- text: يجب أن يعثر تعبيرك المنطقي على 11 رقمًا غير رقمي في <code>&quot;101 Dalmatians&quot;</code> .
testString: 'assert("101 Dalmatians".match(noNumRegex).length == 11, "Your regex should find 11 non-digits in <code>"101 Dalmatians"</code>.");'
- text: 'يجب أن يعثر تعبيرك المعتاد على 15 رقمًا غير رقمي في <code>&quot;One, Two, Three&quot;</code> .'
testString: 'assert("One, Two, Three".match(noNumRegex).length == 15, "Your regex should find 15 non-digits in <code>"One, Two, Three"</code>.");'
- text: يجب أن يعثر تعبيرك المعتاد على 12 رقمًا غير رقمي في <code>&quot;21 Jump Street&quot;</code> .
testString: 'assert("21 Jump Street".match(noNumRegex).length == 12, "Your regex should find 12 non-digits in <code>"21 Jump Street"</code>.");'
- text: 'يجب أن يعثر تعبيرك المعتاد على 17 رقمًا غير رقمي في <code>&quot;2001: A Space Odyssey&quot;</code> .'
testString: 'assert("2001: A Space Odyssey".match(noNumRegex).length == 17, "Your regex should find 17 non-digits in <code>"2001: A Space Odyssey"</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let numString = "Your sandwich will be $5.00";
let noNumRegex = /change/; // Change this line
let result = numString.match(noNumRegex).length;
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,65 @@
---
id: 5d712346c441eddfaeb5bdef
title: Match All Numbers
challengeType: 1
videoUrl: ''
localeTitle: تطابق جميع الأرقام
---
## Description
<section id="description"> لقد تعلمت اختصارات لنماذج السلسلة الشائعة مثل alphanumerics. نمط آخر شائع يبحث عن أرقام أو أرقام فقط. الاختصار للبحث عن أحرف الأرقام هو <code>\d</code> ، مع حرف صغير <code>d</code> . هذا يساوي درجة الحرف <code>[0-9]</code> ، التي تبحث عن حرف واحد لأي رقم بين صفر وتسعة. </section>
## Instructions
<section id="instructions"> استخدم فئة حرف الاختصار <code>\d</code> لحساب عدد الأرقام الموجودة في عناوين الأفلام. الأرقام المكتوبة (&quot;ستة&quot; بدلا من 6) لا تحتسب. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك العادي حرف الاختصار لمطابقة أحرف الأرقام
testString: 'assert(/\\d/.test(numRegex.source), "Your regex should use the shortcut character to match digit characters");'
- text: يجب أن يستخدم تعبيرك العادي العلم العام.
testString: 'assert(numRegex.global, "Your regex should use the global flag.");'
- text: يجب أن يعثر تعبيرك المنطقي على رقم واحد في <code>&quot;9&quot;</code> .
testString: 'assert("9".match(numRegex).length == 1, "Your regex should find 1 digit in <code>"9"</code>.");'
- text: يجب أن يعثر تعبيرك المنطقي على رقمين في <code>&quot;Catch 22&quot;</code> .
testString: 'assert("Catch 22".match(numRegex).length == 2, "Your regex should find 2 digits in <code>"Catch 22"</code>.");'
- text: يجب أن يعثر تعبيرك المنطقي على 3 أرقام في <code>&quot;101 Dalmatians&quot;</code> .
testString: 'assert("101 Dalmatians".match(numRegex).length == 3, "Your regex should find 3 digits in <code>"101 Dalmatians"</code>.");'
- text: 'يجب أن يعثر تعبيرك المنطقي على أي أرقام في <code>&quot;One, Two, Three&quot;</code> .'
testString: 'assert("One, Two, Three".match(numRegex) == null, "Your regex should find no digits in <code>"One, Two, Three"</code>.");'
- text: يجب أن يعثر تعبيرك المنطقي على رقمين في <code>&quot;21 Jump Street&quot;</code> .
testString: 'assert("21 Jump Street".match(numRegex).length == 2, "Your regex should find 2 digits in <code>"21 Jump Street"</code>.");'
- text: 'يجب أن يعثر تعبيرك المنطقي على 4 أرقام في <code>&quot;2001: A Space Odyssey&quot;</code> .'
testString: 'assert("2001: A Space Odyssey".match(numRegex).length == 4, "Your regex should find 4 digits in <code>"2001: A Space Odyssey"</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let numString = "Your sandwich will be $5.00";
let numRegex = /change/; // Change this line
let result = numString.match(numRegex).length;
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,69 @@
---
id: 587d7db5367417b2b2512b94
title: Match Anything with Wildcard Period
challengeType: 1
videoUrl: ''
localeTitle: تطابق أي شيء مع فترة أحرف البدل
---
## Description
<section id="description"> في بعض الأحيان ، لن (أو لا تحتاج إلى) معرفة الأحرف الدقيقة في أنماطك. التفكير في كل الكلمات التي تتطابق مع ، على سبيل المثال ، خطأ إملائي سيستغرق وقتًا طويلاً. لحسن الحظ، يمكنك توفير الوقت باستخدام حرف بدل: <code>.</code> حرف البدل <code>.</code> سوف تطابق أي حرف واحد. ويطلق على حرف البدل أيضا <code>dot</code> <code>period</code> . يمكنك استخدام حرف البدل تمامًا مثل أي حرف آخر في regex. على سبيل المثال ، إذا أردت مطابقة <code>&quot;hug&quot;</code> و <code>&quot;huh&quot;</code> و <code>&quot;hut&quot;</code> و <code>&quot;hum&quot;</code> ، فيمكنك استخدام regex <code>/hu./</code> لمطابقة كل الكلمات الأربع. <blockquote style=";text-align:right;direction:rtl"> لندع humStr = &quot;سوف ألعب أغنية&quot; ؛ <br> let hugStr = &quot;Bear hug&quot;؛ <br> let huRegex = /hu./؛ <br> humStr.match (huRegex)؛ // Returns [&quot;hum&quot;] <br> hugStr.match (huRegex)؛ // Returns [&quot;hug&quot;] </blockquote></section>
## Instructions
<section id="instructions"> أكمل regex <code>unRegex</code> بحيث يتطابق مع السلاسل <code>&quot;run&quot;</code> و <code>&quot;sun&quot;</code> و <code>&quot;fun&quot;</code> و <code>&quot;pun&quot;</code> و <code>&quot;nun&quot;</code> و <code>&quot;bun&quot;</code> . يجب أن يستخدم تعبيرك العادي حرف حرف البدل. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب عليك استخدام طريقة <code>.test()</code> .
testString: 'assert(code.match(/\.test\(.*\)/), "You should use the <code>.test()</code> method.");'
- text: يجب عليك استخدام حرف البدل في regex <code>unRegex</code>
testString: 'assert(/\./.test(unRegex.source), "You should use the wildcard character in your regex <code>unRegex</code>");'
- text: يجب أن يطابق regex <code>unRegex</code> <code>&quot;run&quot;</code> في <code>&quot;Let us go on a run.&quot;</code>
testString: 'assert(unRegex.test("Let us go on a run."), "Your regex <code>unRegex</code> should match <code>"run"</code> in <code>"Let us go on a run."</code>");'
- text: يجب أن يتطابق <code>unRegex</code> regex <code>unRegex</code> مع كلمة <code>&quot;sun&quot;</code> في <code>&quot;The sun is out today.&quot;</code>
testString: 'assert(unRegex.test("The sun is out today."), "Your regex <code>unRegex</code> should match <code>"sun"</code> in <code>"The sun is out today."</code>");'
- text: يجب أن يطابق regex <code>unRegex</code> <code>&quot;fun&quot;</code> في <code>&quot;Coding is a lot of fun.&quot;</code>
testString: 'assert(unRegex.test("Coding is a lot of fun."), "Your regex <code>unRegex</code> should match <code>"fun"</code> in <code>"Coding is a lot of fun."</code>");'
- text: يجب أن يتطابق <code>&quot;pun&quot;</code> regex <code>unRegex</code> مع <code>&quot;pun&quot;</code> في <code>&quot;Seven days without a pun makes one weak.&quot;</code>
testString: 'assert(unRegex.test("Seven days without a pun makes one weak."), "Your regex <code>unRegex</code> should match <code>"pun"</code> in <code>"Seven days without a pun makes one weak."</code>");'
- text: يجب أن يتطابق <code>unRegex</code> regex <code>unRegex</code> مع <code>&quot;nun&quot;</code> في <code>&quot;One takes a vow to be a nun.&quot;</code> <code>unRegex</code> <code>&quot;One takes a vow to be a nun.&quot;</code>
testString: 'assert(unRegex.test("One takes a vow to be a nun."), "Your regex <code>unRegex</code> should match <code>"nun"</code> in <code>"One takes a vow to be a nun."</code>");'
- text: يجب أن تتطابق مع regex <code>unRegex</code> <code>&quot;bun&quot;</code> في <code>&quot;She got fired from the hot dog stand for putting her hair in a bun.&quot;</code> <code>unRegex</code> <code>&quot;She got fired from the hot dog stand for putting her hair in a bun.&quot;</code>
testString: 'assert(unRegex.test("She got fired from the hot dog stand for putting her hair in a bun."), "Your regex <code>unRegex</code> should match <code>"bun"</code> in <code>"She got fired from the hot dog stand for putting her hair in a bun."</code>");'
- text: يجب ألا يطابق regex <code>unRegex</code> <code>&quot;There is a bug in my code.&quot;</code>
testString: 'assert(!unRegex.test("There is a bug in my code."), "Your regex <code>unRegex</code> should not match <code>"There is a bug in my code."</code>");'
- text: يجب ألا يتطابق التعبير <code>unRegex</code> regex <code>unRegex</code> مع <code>&quot;Catch me if you can.&quot;</code>
testString: 'assert(!unRegex.test("Can me if you can."), "Your regex <code>unRegex</code> should not match <code>"Catch me if you can."</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let exampleStr = "Let's have fun with regular expressions!";
let unRegex = /change/; // Change this line
let result = unRegex.test(exampleStr);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,57 @@
---
id: 587d7db7367417b2b2512b9d
title: Match Beginning String Patterns
challengeType: 1
videoUrl: ''
localeTitle: مباراة بداية أنماط سلسلة
---
## Description
<section id="description"> أظهرت التحديات السابقة أنه يمكن استخدام التعبيرات العادية للبحث عن عدد من التطابقات. كما يتم استخدامها للبحث عن أنماط في مواضع محددة في السلاسل. في تحدي سابق ، استخدمت <code>caret</code> ( <code>^</code> ) داخل مجموعة <code>character set</code> لإنشاء مجموعة <code>negated character set</code> <code>[^thingsThatWillNotBeMatched]</code> في النموذج <code>[^thingsThatWillNotBeMatched]</code> . خارج مجموعة <code>character set</code> ، يتم استخدام <code>caret</code> للبحث عن الأنماط في بداية السلاسل. <blockquote style=";text-align:right;direction:rtl"> let firstString = &quot;Ricky is first and can be found.&quot;؛ <br> let firstRegex = / ^ Ricky /؛ <br> firstRegex.test (firstString)؛ <br> // يعود صحيح <br> let notFirst = &quot;لا يمكنك العثور على Ricky الآن.&quot;؛ <br> firstRegex.test (notFirst)؛ <br> // إرجاع خاطئة </blockquote></section>
## Instructions
<section id="instructions"> استخدم <code>caret</code> في تعبير منطقي للبحث عن <code>&quot;Cal&quot;</code> فقط في بداية السلسلة <code>rickyAndCal</code> . </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يبحث التعبير المعتاد عن <code>&quot;Cal&quot;</code> بحرف كبير.
testString: 'assert(calRegex.source == "^Cal", "Your regex should search for <code>"Cal"</code> with a capital letter.");'
- text: يجب ألا يستخدم تعبيرك المعتاد أي أعلام.
testString: 'assert(calRegex.flags == "", "Your regex should not use any flags.");'
- text: يجب أن يتطابق تعبيرك العادي مع كلمة <code>&quot;Cal&quot;</code> في بداية السلسلة.
testString: 'assert(calRegex.test("Cal and Ricky both like racing."), "Your regex should match <code>"Cal"</code> at the beginning of the string.");'
- text: يجب ألا يتطابق التعبير العادي مع <code>&quot;Cal&quot;</code> في وسط سلسلة.
testString: 'assert(!calRegex.test("Ricky and Cal both like racing."), "Your regex should not match <code>"Cal"</code> in the middle of a string.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let rickyAndCal = "Cal and Ricky both like racing.";
let calRegex = /change/; // Change this line
let result = calRegex.test(rickyAndCal);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 587d7db6367417b2b2512b99
title: Match Characters that Occur One or More Times
challengeType: 1
videoUrl: ''
localeTitle: مطابقة الأحرف التي تحدث مرة واحدة أو أكثر
---
## Description
<section id="description"> في بعض الأحيان ، تحتاج إلى مطابقة حرف (أو مجموعة من الأحرف) التي تظهر مرة واحدة أو أكثر في صف واحد. هذا يعني أنه يحدث مرة واحدة على الأقل ، ويمكن أن يتكرر. يمكنك استخدام <code>+</code> للتحقق مما إذا كانت هذه هي الحالة. تذكر ، يجب أن تكون الشخصية أو النمط موجودًا على التوالي. بمعنى ، يجب على الحرف تكرار واحد بعد الآخر. على سبيل المثال ، سيعثر <code>/a+/g</code> على تطابق واحد في <code>&quot;abc&quot;</code> وإرجاع <code>[&quot;a&quot;]</code> . نظرًا لوجود <code>+</code> ، سيجد أيضًا تطابقًا واحدًا في <code>&quot;aabc&quot;</code> وإرجاع <code>[&quot;aa&quot;]</code> . لو كانت بدلا التحقق من سلسلة <code>&quot;abab&quot;</code> ، فإنه يجد مباراتين والعودة <code>[&quot;a&quot;, &quot;a&quot;]</code> لأن <code>a</code> الأحرف ليست في صف واحد - هناك <code>b</code> بينهما. أخيرًا ، نظرًا لعدم وجود <code>&quot;a&quot;</code> في السلسلة <code>&quot;bcd&quot;</code> ، فلن تجد تطابقًا. </section>
## Instructions
<section id="instructions"> تريد البحث عن تطابقات عندما يحدث الحرف <code>s</code> مرة أو أكثر في <code>&quot;Mississippi&quot;</code> . اكتب regex يستخدم علامة <code>+</code> . </section>
## Tests
<section id='tests'>
```yml
tests:
- text: التعابير المنطقية الخاصة بك <code>myRegex</code> يجب استخدام <code>+</code> إشارة لمباراة واحدة أو أكثر من <code>s</code> حرفا.
testString: 'assert(/\+/.test(myRegex.source), "Your regex <code>myRegex</code> should use the <code>+</code> sign to match one or more <code>s</code> characters.");'
- text: يجب أن يتطابق التعبير العادي مع <code>myRegex</code> مع عنصرين.
testString: 'assert(result.length == 2, "Your regex <code>myRegex</code> should match 2 items.");'
- text: يجب أن يكون متغير <code>result</code> مصفوفة تحتوي على مجموعتين من <code>&quot;ss&quot;</code>
testString: 'assert(result[0] == "ss" && result[1] == "ss", "The <code>result</code> variable should be an array with two matches of <code>"ss"</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let difficultSpelling = "Mississippi";
let myRegex = /change/; // Change this line
let result = difficultSpelling.match(myRegex);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 587d7db6367417b2b2512b9a
title: Match Characters that Occur Zero or More Times
challengeType: 1
videoUrl: ''
localeTitle: مطابقة الأحرف التي تحدث Zero أو أوقات إضافية
---
## Description
<section id="description"> استخدم التحدي الأخير علامة زائد <code>+</code> للبحث عن الأحرف التي تحدث مرة واحدة أو أكثر. هناك أيضًا خيار يطابق الأحرف التي تحدث صفرًا أو أكثر. الحرف للقيام بذلك هو <code>asterisk</code> أو <code>star</code> : <code>*</code> . <blockquote style=";text-align:right;direction:rtl"> let soccerWord = &quot;gooooooooal!&quot;؛ <br> دعونا gPhrase = &quot;الشعور الغريزي&quot; ؛ <br> دع oPhrase = &quot;فوق القمر&quot; ؛ <br> اترك goRegex = / go * /؛ <br> soccerWord.match (goRegex)؛ // Returns [&quot;goooooooo&quot;] <br> gPhrase.match (goRegex)؛ // Returns [&quot;g&quot;] <br> oPhrase.match (goRegex)؛ // يعود لاغيا </blockquote></section>
## Instructions
<section id="instructions"> إنشاء regex <code>chewieRegex</code> يستخدم الحرف <code>*</code> لتطابق كافة الأحرف <code>&quot;a&quot;</code> العلوي والسفلي في <code>chewieQuote</code> . لا يحتاج تعبيرك العادي إلى علامات ، ولا ينبغي أن يتطابق مع أي من علامات الاقتباس الأخرى. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم regex <code>chewieRegex</code> <code>*</code> لمطابقة صفر أو أكثر <code>a</code> الأحرف.
testString: 'assert(/\*/.test(chewieRegex.source), "Your regex <code>chewieRegex</code> should use the <code>*</code> character to match zero or more <code>a</code> characters.");'
- text: يجب أن يتطابق التعبير العادي regex <code>chewieRegex</code> مع 16 حرفًا.
testString: 'assert(result[0].length === 16, "Your regex <code>chewieRegex</code> should match 16 characters.");'
- text: يجب أن يتطابق <code>&quot;Aaaaaaaaaaaaaaaa&quot;</code> العادي مع <code>&quot;Aaaaaaaaaaaaaaaa&quot;</code> .
testString: 'assert(result[0] === "Aaaaaaaaaaaaaaaa", "Your regex should match <code>"Aaaaaaaaaaaaaaaa"</code>.");'
- text: 'يجب ألا يتطابق تعبيرك المعتاد مع أي أحرف في <code>&quot;He made a fair move. Screaming about it can&#39;t help you.&quot;</code>'
testString: 'assert(!"He made a fair move. Screaming about it can\"t help you.".match(chewieRegex), "Your regex should not match any characters in <code>"He made a fair move. Screaming about it can&#39t help you."</code>");'
- text: 'يجب ألا يتطابق <code>&quot;Let him have it. It&#39;s not wise to upset a Wookiee.&quot;</code> المعتاد مع أي أحرف في <code>&quot;Let him have it. It&#39;s not wise to upset a Wookiee.&quot;</code>'
testString: 'assert(!"Let him have it. It\"s not wise to upset a Wookiee.".match(chewieRegex), "Your regex should not match any characters in <code>"Let him have it. It&#39s not wise to upset a Wookiee."</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
let chewieRegex = /change/; // Change this line
let result = chewieQuote.match(chewieRegex);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 587d7db7367417b2b2512b9e
title: Match Ending String Patterns
challengeType: 1
videoUrl: ''
localeTitle: تطابق نهاية أنماط سلسلة
---
## Description
<section id="description"> في التحدي الأخير ، تعلمت استخدام <code>caret</code> للبحث عن الأنماط في بداية السلاسل. هناك أيضًا طريقة للبحث عن الأنماط في نهاية السلاسل. يمكنك البحث في نهاية السلاسل باستخدام حرف <code>dollar sign</code> <code>$</code> في نهاية التعليمة regex. <blockquote style=";text-align:right;direction:rtl"> دع theEnding = &quot;هذه قصة لا تنتهي أبدا&quot;؛ <br> let storyRegex = / story $ /؛ <br> storyRegex.test (theEnding)؛ <br> // يعود صحيح <br> let noEnding = &quot;في بعض الأحيان يجب أن تنتهي القصة&quot; ؛ <br> storyRegex.test (noEnding)؛ <br> // إرجاع خاطئة <br></blockquote></section>
## Instructions
<section id="instructions"> استخدم حرف الربط ( <code>$</code> ) لمطابقة السلسلة <code>&quot;caboose&quot;</code> في نهاية سلسلة <code>caboose</code> . </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب عليك البحث عن <code>&quot;caboose&quot;</code> باستخدام علامة الدولار <code>$</code> anchor في تعبيرك المعتاد.
testString: 'assert(lastRegex.source == "caboose$", "You should search for <code>"caboose"</code> with the dollar sign <code>$</code> anchor in your regex.");'
- text: يجب ألا يستخدم تعبيرك المعتاد أي أعلام.
testString: 'assert(lastRegex.flags == "", "Your regex should not use any flags.");'
- text: يجب أن تتطابق مع <code>&quot;caboose&quot;</code> في نهاية السلسلة <code>&quot;The last car on a train is the caboose&quot;</code>
testString: 'assert(lastRegex.test("The last car on a train is the caboose"), "You should match <code>"caboose"</code> at the end of the string <code>"The last car on a train is the caboose"</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let caboose = "The last car on a train is the caboose";
let lastRegex = /change/; // Change this line
let result = lastRegex.test(caboose);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: 587d7db8367417b2b2512ba0
title: Match Everything But Letters and Numbers
challengeType: 1
videoUrl: ''
localeTitle: تطابق كل شيء لكن الحروف والأرقام
---
## Description
<section id="description"> لقد تعلمت أنه يمكنك استخدام اختصار لمطابقة <code>[A-Za-z0-9_]</code> الأبجدية العددية <code>[A-Za-z0-9_]</code> باستخدام <code>\w</code> . النمط الطبيعي الذي قد ترغب في البحث عنه هو عكس alphanumerics. يمكنك البحث عن عكس <code>\w</code> مع <code>\W</code> لاحظ أن النمط المعاكس يستخدم حرفًا كبيرًا. هذا الاختصار هو نفسه <code>[^A-Za-z0-9_]</code> . <blockquote style=";text-align:right;direction:rtl"> اترك shortHand = / \ W /؛ <br> السماح للأرقام = &quot;42 ٪&quot; ؛ <br> اسمحوا الجملة = &quot;الترميز!&quot; ؛ <br> numbers.match (اختزال)؛ // عائدات [&quot;٪&quot;] <br> sentence.match (اختزال)؛ // عائدات [&quot;!&quot;] <br></blockquote></section>
## Instructions
<section id="instructions"> استخدم class <code>\W</code> حرف الاختصار لحساب عدد الأحرف غير الأبجدية الرقمية في علامات الاقتباس والسلاسل المختلفة. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك العادي العلم العام.
testString: 'assert(nonAlphabetRegex.global, "Your regex should use the global flag.");'
- text: يجب أن يعثر تعبيرك المنطقي على 6 أحرف غير أبجدية رقمية في <code>&quot;The five boxing wizards jump quickly.&quot;</code> .
testString: 'assert("The five boxing wizards jump quickly.".match(nonAlphabetRegex).length == 6, "Your regex should find 6 non-alphanumeric characters in <code>"The five boxing wizards jump quickly."</code>.");'
- text: يجب أن يستخدم تعبيرك العادي الحرف المختصر.
testString: 'assert(/\\W/.test(nonAlphabetRegex.source), "Your regex should use the shorthand character to match characters which are non-alphanumeric.");'
- text: يجب أن يعثر تعبيرك المنطقي على 8 أحرف غير أبجدية رقمية في <code>&quot;Pack my box with five dozen liquor jugs.&quot;</code>
testString: 'assert("Pack my box with five dozen liquor jugs.".match(nonAlphabetRegex).length == 8, "Your regex should find 8 non-alphanumeric characters in <code>"Pack my box with five dozen liquor jugs."</code>");'
- text: يجب أن يعثر تعبيرك المنطقي على 6 أحرف غير أبجدية رقمية في <code>&quot;How vexingly quick daft zebras jump!&quot;</code>
testString: 'assert("How vexingly quick daft zebras jump!".match(nonAlphabetRegex).length == 6, "Your regex should find 6 non-alphanumeric characters in <code>"How vexingly quick daft zebras jump!"</code>");'
- text: يجب أن يعثر <code>&quot;123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.&quot;</code> على 12 حرفًا غير أبجدي رقمي في <code>&quot;123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.&quot;</code>
testString: 'assert("123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ.".match(nonAlphabetRegex).length == 12, "Your regex should find 12 non-alphanumeric characters in <code>"123 456 7890 ABC def GHI jkl MNO pqr STU vwx YZ."</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let quoteSample = "The five boxing wizards jump quickly.";
let nonAlphabetRegex = /change/; // Change this line
let result = quoteSample.match(nonAlphabetRegex).length;
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 587d7db5367417b2b2512b96
title: Match Letters of the Alphabet
challengeType: 1
videoUrl: ''
localeTitle: تطابق حروف الأبجدية
---
## Description
<section id="description"> لقد رأيت كيف يمكنك استخدام <code>character sets</code> لتحديد مجموعة من الأحرف لمطابقة ، ولكن هذا كثير من الكتابة عندما تحتاج إلى مطابقة مجموعة كبيرة من الأحرف (على سبيل المثال ، كل حرف في الأبجدية). لحسن الحظ ، هناك ميزة مضمنة تجعل هذا قصيرة وبسيطة. داخل مجموعة <code>character set</code> ، يمكنك تحديد نطاق من الأحرف لمطابقة أحرف <code>hyphen</code> : <code>-</code> . على سبيل المثال ، لمطابقة الأحرف الصغيرة <code>a</code> خلال <code>e</code> قد تستخدم <code>[ae]</code> . <blockquote style=";text-align:right;direction:rtl"> دع catStr = &quot;قطة&quot; ؛ <br> السماح batStr = &quot;الخفافيش&quot; ؛ <br> السماح matStr = &quot;حصيرة&quot; ؛ <br> let bgRegex = / [ae] at /؛ <br> catStr.match (bgRegex)؛ // Returns [&quot;cat&quot;] <br> batStr.match (bgRegex)؛ // Returns [&quot;bat&quot;] <br> matStr.match (bgRegex)؛ // يعود لاغيا </blockquote></section>
## Instructions
<section id="instructions"> تطابق جميع الحروف في سلسلة <code>quoteSample</code> . <strong>ملحوظة</strong> <br> تأكد من مطابقة الأحرف <strong>الكبيرة</strong> والصغيرة <strong><strong>.</strong></strong> </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يتطابق معجمك <code>alphabetRegex</code> مع 35 عنصرًا.
testString: 'assert(result.length == 35, "Your regex <code>alphabetRegex</code> should match 35 items.");'
- text: يجب أن يستخدم <code>alphabetRegex</code> reggex <code>alphabetRegex</code> العلم العام.
testString: 'assert(alphabetRegex.flags.match(/g/).length == 1, "Your regex <code>alphabetRegex</code> should use the global flag.");'
- text: التعابير المنطقية الخاصة بك <code>alphabetRegex</code> يجب استخدام حالة العلم حساسة.
testString: 'assert(alphabetRegex.flags.match(/i/).length == 1, "Your regex <code>alphabetRegex</code> should use the case insensitive flag.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let quoteSample = "The quick brown fox jumps over the lazy dog.";
let alphabetRegex = /change/; // Change this line
let result = alphabetRegex; // Change this line
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 587d7db3367417b2b2512b8f
title: Match Literal Strings
challengeType: 1
videoUrl: ''
localeTitle: المباراة الحرفيه الاوتار
---
## Description
<section id="description"> في التحدي الأخير ، قمت بالبحث عن كلمة <code>&quot;Hello&quot;</code> باستخدام التعبير العادي <code>/Hello/</code> . بحث هذا التعبير المنطقي عن تطابق حرفي لسلسلة <code>&quot;Hello&quot;</code> . إليك مثال آخر يبحث عن مطابقة حرفية لسلسلة <code>&quot;Kevin&quot;</code> : <blockquote style=";text-align:right;direction:rtl"> let testStr = &quot;مرحبًا ، اسمي كيفن.&quot;؛ <br> let testRegex = / Kevin /؛ <br> testRegex.test (testStr)؛ <br> // يعود صحيح </blockquote> أي أشكال أخرى من <code>&quot;Kevin&quot;</code> لن تتطابق. على سبيل المثال ، لن يتطابق regex <code>/Kevin/</code> مع <code>&quot;kevin&quot;</code> أو <code>&quot;KEVIN&quot;</code> . <blockquote style=";text-align:right;direction:rtl"> let wrongRegex = / kevin /؛ <br> wrongRegex.test (testStr)؛ <br> // إرجاع خاطئة </blockquote> سيظهر تحدٍّ مستقبلي كيفية مضاهاة هذه الأشكال الأخرى أيضًا. </section>
## Instructions
<section id="instructions"> أكمل <code>waldoRegex</code> regex للعثور على <code>&quot;Waldo&quot;</code> في السلسلة <code>waldoIsHiding</code> مع مطابقة حرفية. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يجد <code>waldoRegex</code> regex الخاص بك <code>&quot;Waldo&quot;</code>
testString: 'assert(waldoRegex.test(waldoIsHiding), "Your regex <code>waldoRegex</code> should find <code>"Waldo"</code>");'
- text: يجب ألا يبحث regex <code>waldoRegex</code> عن أي شيء آخر.
testString: 'assert(!waldoRegex.test("Somewhere is hiding in this text."), "Your regex <code>waldoRegex</code> should not search for anything else.");'
- text: يجب إجراء مطابقة سلسلة حرفية مع تعبيرك المعتاد.
testString: 'assert(!/\/.*\/i/.test(code), "You should perform a literal string match with your regex.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let waldoIsHiding = "Somewhere Waldo is hiding in this text.";
let waldoRegex = /search/; // Change this line
let result = waldoRegex.test(waldoIsHiding);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 587d7db9367417b2b2512ba4
title: Match Non-Whitespace Characters
challengeType: 1
videoUrl: ''
localeTitle: تطابق أحرف غير بيضاء
---
## Description
<section id="description"> لقد تعلمت عن البحث عن المسافات البيضاء باستخدام <code>\s</code> ، باستخدام <code>s</code> صغير. يمكنك أيضًا البحث عن كل شيء ما عدا المسافة البيضاء. البحث عن غير بيضاء، يستخدم <code>\S</code> ، وهي الأحرف الكبيرة <code>s</code> . لن يطابق هذا النمط المسافات البيضاء ، والعودة إلى السطر ، وعلامة التبويب ، وتغذية النموذج ، وأحرف الخطوط الجديدة. يمكنك التفكير في كونه مشابهًا لفئة الأحرف <code>[^ \r\t\f\n\v]</code> . <blockquote style=";text-align:right;direction:rtl"> let whiteSpace = &quot;Whitespace. Whitespace everywhere!&quot; <br> اترك nonSpaceRegex = / \ S / g؛ <br> whiteSpace.match (nonSpaceRegex) مدة العرض. // إرجاع 32 </blockquote></section>
## Instructions
<section id="instructions"> غيّر <code>countNonWhiteSpace</code> regex للبحث عن أحرف non-whitespace متعددة في سلسلة. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك العادي العلم العام.
testString: 'assert(countNonWhiteSpace.global, "Your regex should use the global flag.");'
- text: يجب أن يستخدم تعبيرك العادي الحرف المختصر
testString: 'assert(/\\S/.test(countNonWhiteSpace.source), "Your regex should use the shorthand character <code>\S/code> to match all non-whitespace characters.");'
- text: يجب أن يعثر تعبيرك المعتاد على 35 حالة غير مسافات في <code>&quot;Men are from Mars and women are from Venus.&quot;</code>
testString: 'assert("Men are from Mars and women are from Venus.".match(countNonWhiteSpace).length == 35, "Your regex should find 35 non-spaces in <code>"Men are from Mars and women are from Venus."</code>");'
- text: 'يجب أن يعثر تعبيرك المعتاد على 23 منطقة غير مسافات في <code>&quot;Space: the final frontier.&quot;</code>'
testString: 'assert("Space: the final frontier.".match(countNonWhiteSpace).length == 23, "Your regex should find 23 non-spaces in <code>"Space: the final frontier."</code>");'
- text: يجب أن يعثر <code>&quot;MindYourPersonalSpace&quot;</code> على 21 <code>&quot;MindYourPersonalSpace&quot;</code> غير مسافات في <code>&quot;MindYourPersonalSpace&quot;</code>
testString: 'assert("MindYourPersonalSpace".match(countNonWhiteSpace).length == 21, "Your regex should find 21 non-spaces in <code>"MindYourPersonalSpace"</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let sample = "Whitespace is important in separating words";
let countNonWhiteSpace = /change/; // Change this line
let result = sample.match(countNonWhiteSpace);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 587d7db5367417b2b2512b97
title: Match Numbers and Letters of the Alphabet
challengeType: 1
videoUrl: ''
localeTitle: أرقام المباراة ورسائل الأبجدية
---
## Description
<section id="description"> لا يقتصر استخدام الواصلة ( <code>-</code> ) لمطابقة نطاق من الأحرف على الأحرف. كما يعمل على مطابقة مجموعة من الأرقام. على سبيل المثال ، <code>/[0-5]/</code> تطابق أي رقم بين <code>0</code> و <code>5</code> ، بما في ذلك <code>0</code> و <code>5</code> . أيضا ، من الممكن الجمع بين مجموعة من الحروف والأرقام في مجموعة أحرف واحدة. <blockquote style=";text-align:right;direction:rtl"> let jennyStr = &quot;Jenny8675309&quot;؛ <br> let myRegex = / [a-z0-9] / ig؛ <br> // تطابق جميع الحروف والأرقام في jennyStr <br> jennyStr.match (myRegex)؛ </blockquote></section>
## Instructions
<section id="instructions"> أنشئ تعبيرًا واحدًا يتطابق مع نطاق من الأحرف بين <code>h</code> و <code>s</code> ومجموعة من الأرقام بين <code>2</code> و <code>6</code> . تذكر تضمين الأعلام المناسبة في التعابير المنطقية. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يتطابق <code>myRegex</code> مع 17 عنصرًا.
testString: 'assert(result.length == 17, "Your regex <code>myRegex</code> should match 17 items.");'
- text: يجب أن يستخدم <code>myRegex</code> regex العلامة العامة.
testString: 'assert(myRegex.flags.match(/g/).length == 1, "Your regex <code>myRegex</code> should use the global flag.");'
- text: يجب أن يستخدم <code>myRegex</code> regex <code>myRegex</code> حالة الأحرف.
testString: 'assert(myRegex.flags.match(/i/).length == 1, "Your regex <code>myRegex</code> should use the case insensitive flag.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let quoteSample = "Blueberry 3.141592653s are delicious.";
let myRegex = /change/; // Change this line
let result = myRegex; // Change this line
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 587d7db5367417b2b2512b95
title: Match Single Character with Multiple Possibilities
challengeType: 1
videoUrl: ''
localeTitle: تطابق شخصية واحدة مع إمكانيات متعددة
---
## Description
<section id="description"> تعلمت كيف تتطابق مع الأنماط الحرفية ( <code>/literal/</code> ) وحرف البدل ( <code>/./</code> ). هذه هي الحدود القصوى للتعبيرات العادية ، حيث يجد المرء مباريات متطابقة ويطابق الآخر كل شيء. هناك خيارات توازن بين النقيضين. يمكنك البحث عن نمط حرفية مع بعض المرونة مع <code>character classes</code> . تتيح لك فئات الأحرف تعريف مجموعة من الأحرف التي ترغب في مطابقتها بوضعها داخل أقواس مربعة ( <code>[</code> و <code>]</code> ). على سبيل المثال ، تريد مطابقة <code>&quot;bag&quot;</code> و <code>&quot;big&quot;</code> و <code>&quot;bug&quot;</code> وليس <code>&quot;bog&quot;</code> . يمكنك إنشاء regex <code>/b[aiu]g/</code> للقيام بذلك. إن <code>[aiu]</code> هو فئة الشخصية التي تتطابق فقط مع الأحرف <code>&quot;a&quot;</code> أو <code>&quot;i&quot;</code> أو <code>&quot;u&quot;</code> . <blockquote style=";text-align:right;direction:rtl"> let bigStr = &quot;big&quot;؛ <br> اسمحوا bagStr = &quot;حقيبة&quot; ؛ <br> let bugStr = &quot;bug&quot;؛ <br> let bogStr = &quot;bog&quot;؛ <br> let bgRegex = / b [aiu] g /؛ <br> bigStr.match (bgRegex)؛ // Returns [&quot;big&quot;] <br> bagStr.match (bgRegex)؛ // Returns [&quot;bag&quot;] <br> bugStr.match (bgRegex)؛ // Returns [&quot;bug&quot;] <br> bogStr.match (bgRegex)؛ // يعود لاغيا </blockquote></section>
## Instructions
<section id="instructions"> استخدم فئة أحرف مع أحرف العلة ( <code>a</code> ، <code>e</code> ، <code>i</code> ، <code>o</code> ، <code>u</code> ) في your regex <code>vowelRegex</code> للعثور على جميع حروف العلة في سلسلة <code>quoteSample</code> . <strong>ملحوظة</strong> <br> تأكد من مطابقة حروف العلة العلوية والصغيرة. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن تجد كل الحروف المتحركة 25.
testString: 'assert(result.length == 25, "You should find all 25 vowels.");'
- text: يجب أن يستخدم regex <code>vowelRegex</code> فئة شخصية.
testString: 'assert(/\[.*\]/.test(vowelRegex.source), "Your regex <code>vowelRegex</code> should use a character class.");'
- text: يجب أن يستخدم regex <code>vowelRegex</code> العلم العام.
testString: 'assert(vowelRegex.flags.match(/g/).length == 1, "Your regex <code>vowelRegex</code> should use the global flag.");'
- text: يجب أن يستخدم <code>vowelRegex</code> regex <code>vowelRegex</code> علم حالة الأحرف.
testString: 'assert(vowelRegex.flags.match(/i/).length == 1, "Your regex <code>vowelRegex</code> should use the case insensitive flag.");'
- text: يجب ألا يطابق تعبيرك المعتاد أي أحرف ساكنة.
testString: 'assert(!/[b-df-hj-np-tv-z]/gi.test(result.join()), "Your regex should not match any consonants.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let quoteSample = "Beware of bugs in the above code; I have only proved it correct, not tried it.";
let vowelRegex = /change/; // Change this line
let result = vowelRegex; // Change this line
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 587d7db6367417b2b2512b98
title: Match Single Characters Not Specified
challengeType: 1
videoUrl: ''
localeTitle: مطابقة أحرف مفردة غير محددة
---
## Description
<section id="description"> حتى الآن ، قمت بإنشاء مجموعة من الأحرف التي تريد مطابقتها ، ولكن يمكنك أيضًا إنشاء مجموعة من الأحرف التي لا تريد مطابقتها. تسمى هذه الأنواع من مجموعات <code>negated character sets</code> . لإنشاء مجموعة <code>negated character set</code> ، تضع <code>caret</code> ( <code>^</code> ) بعد قوس الفتح وقبل الأحرف التي لا تريد مطابقتها. على سبيل المثال ، يطابق <code>/[^aeiou]/gi</code> كافة الأحرف التي ليست حرف علة. لاحظ أن أحرف مثل <code>.</code> <code>!</code> تتم مطابقة ، <code>[</code> ، <code>@</code> ، <code>/</code> وفضاء أبيض] - تستبعد مجموعة أحرف العلة المنسوخة أحرف الأحرف المتحركة فقط. </section>
## Instructions
<section id="instructions"> قم بإنشاء تعبير عادي واحد يتطابق مع كل الحروف التي ليست رقمًا أو حرفًا متحركًا. تذكر تضمين الأعلام المناسبة في التعابير المنطقية. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يتطابق <code>myRegex</code> مع 9 عناصر.
testString: 'assert(result.length == 9, "Your regex <code>myRegex</code> should match 9 items.");'
- text: يجب أن يستخدم <code>myRegex</code> regex العلامة العامة.
testString: 'assert(myRegex.flags.match(/g/).length == 1, "Your regex <code>myRegex</code> should use the global flag.");'
- text: يجب أن يستخدم <code>myRegex</code> regex <code>myRegex</code> حالة الأحرف.
testString: 'assert(myRegex.flags.match(/i/).length == 1, "Your regex <code>myRegex</code> should use the case insensitive flag.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let quoteSample = "3 blind mice.";
let myRegex = /change/; // Change this line
let result = myRegex; // Change this line
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 587d7db8367417b2b2512ba3
title: Match Whitespace
challengeType: 1
videoUrl: ''
localeTitle: تطابق الفراغ
---
## Description
<section id="description"> غطت التحديات حتى الآن الحروف المطابقة للأبجدية والأرقام. يمكنك أيضًا مطابقة المسافة البيضاء أو المسافات بين الأحرف. يمكنك البحث عن المسافات باستخدام <code>\s</code> ، وهي صغيرة <code>s</code> . لا يطابق هذا النمط المسافة البيضاء فحسب ، بل يطابق أيضًا أحرف الإرجاع ، وعلامة التبويب ، وتغذية النموذج ، وأحرف الخطوط الجديدة. يمكنك اعتباره مشابهًا لفئة الأحرف <code>[ \r\t\f\n\v]</code> . <blockquote style=";text-align:right;direction:rtl"> let whiteSpace = &quot;Whitespace. Whitespace everywhere!&quot; <br> اترك spaceRegex = / \ s / g؛ <br> whiteSpace.match (spaceRegex)؛ <br> // عائدات [&quot; &quot;، &quot; &quot;] <br></blockquote></section>
## Instructions
<section id="instructions"> غيّر <code>countWhiteSpace</code> regex للبحث عن أحرف بيضاء متعددة في سلسلة. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك العادي العلم العام.
testString: 'assert(countWhiteSpace.global, "Your regex should use the global flag.");'
- text: يجب أن يستخدم تعبيرك العادي الحرف المختصر
testString: 'assert(/\\s/.test(countWhiteSpace.source), "Your regex should use the shorthand character <code>\s</code> to match all whitespace characters.");'
- text: يجب أن يعثر تعبيرك المعتاد على ثماني مساحات في <code>&quot;Men are from Mars and women are from Venus.&quot;</code>
testString: 'assert("Men are from Mars and women are from Venus.".match(countWhiteSpace).length == 8, "Your regex should find eight spaces in <code>"Men are from Mars and women are from Venus."</code>");'
- text: 'يجب أن يعثر تعبيرك المعتاد على ثلاث مسافات في <code>&quot;Space: the final frontier.&quot;</code>'
testString: 'assert("Space: the final frontier.".match(countWhiteSpace).length == 3, "Your regex should find three spaces in <code>"Space: the final frontier."</code>");'
- text: يجب ألا يجد <code>&quot;MindYourPersonalSpace&quot;</code> أي مسافات في <code>&quot;MindYourPersonalSpace&quot;</code>
testString: 'assert("MindYourPersonalSpace".match(countWhiteSpace) == null, "Your regex should find no spaces in <code>"MindYourPersonalSpace"</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let sample = "Whitespace is important in separating words";
let countWhiteSpace = /change/; // Change this line
let result = sample.match(countWhiteSpace);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,65 @@
---
id: 587d7dba367417b2b2512ba9
title: Positive and Negative Lookahead
challengeType: 1
videoUrl: ''
localeTitle: الإيجابية و السلبية Lookahead
---
## Description
<section id="description"> <code>Lookaheads</code> هي الأنماط التي تخبر جافا سكريبت أن ننظر إلى الأمام في السلسلة الخاصة بك للتحقق من وجود أنماط أخرى على طول. يمكن أن يكون ذلك مفيدًا عندما تريد البحث عن أنماط متعددة عبر نفس السلسلة. هناك نوعان من <code>lookaheads</code> : <code>positive lookahead</code> و <code>negative lookahead</code> . سوف ننظر <code>positive lookahead</code> للتأكد من وجود عنصر في نمط البحث ، ولكن لن تتطابق في الواقع. يتم استخدام lookahead إيجابية كما <code>(?=...)</code> حيث <code>...</code> هو الجزء المطلوب غير متطابق. من ناحية أخرى ، سوف ننظر <code>negative lookahead</code> للتأكد من عدم وجود عنصر في نمط البحث. يتم استخدام lookahead سلبي كما <code>(?!...)</code> حيث <code>...</code> هو النمط الذي لا تريد أن تكون هناك. يتم إرجاع بقية النمط إذا كان جزء lookahead السلبي غير موجود. Lookaheads مربكة بعض الشيء ولكن بعض الأمثلة سوف تساعد. <blockquote style=";text-align:right;direction:rtl"> ترك quit = &quot;qu&quot;؛ <br> let noquit = &quot;qt&quot;؛ <br> let quRegex = / q (؟ = u) /؛ <br> اترك qRegex = / q (؟! u) /؛ <br> quit.match (quRegex)؛ // Returns [&quot;q&quot;] <br> noquit.match (qRegex)؛ // Returns [&quot;q&quot;] </blockquote> استخدام أكثر عملية من <code>lookaheads</code> هو التحقق من اثنين أو أكثر من الأنماط في سلسلة واحدة. هنا مدقق كلمات مرور بسيط (بسذاجة) يبحث عن 3 إلى 6 أحرف ورقم واحد على الأقل: <blockquote style=";text-align:right;direction:rtl"> السماح بكلمة المرور = &quot;abc123&quot; ؛ <br> let checkPass = / (؟ = \ w {3،6}) (؟ = \ D * \ d) /؛ <br> checkPass.test (كلمة السر)؛ // يعود صحيح </blockquote></section>
## Instructions
<section id="instructions"> استخدم <code>lookaheads</code> في <code>pwRegex</code> لمطابقة كلمات المرور التي يزيد طولها عن 5 أحرف ولها رقمين متتاليين. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم <code>lookaheads</code> إيجابية.
testString: 'assert(pwRegex.source.match(/\(\?=.*?\)\(\?=.*?\)/) !== null, "Your regex should use two positive <code>lookaheads</code>.");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>&quot;astronaut&quot;</code>
testString: 'assert(!pwRegex.test("astronaut"), "Your regex should not match <code>"astronaut"</code>");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>&quot;airplanes&quot;</code>
testString: 'assert(!pwRegex.test("airplanes"), "Your regex should not match <code>"airplanes"</code>");'
- text: يجب ألا يتطابق التعبير العادي مع <code>&quot;banan1&quot;</code>
testString: 'assert(!pwRegex.test("banan1"), "Your regex should not match <code>"banan1"</code>");'
- text: يجب أن يتطابق <code>&quot;bana12&quot;</code> العادي مع <code>&quot;bana12&quot;</code>
testString: 'assert(pwRegex.test("bana12"), "Your regex should match <code>"bana12"</code>");'
- text: يجب أن يتطابق التعبير العادي مع <code>&quot;abc123&quot;</code>
testString: 'assert(pwRegex.test("abc123"), "Your regex should match <code>"abc123"</code>");'
- text: يجب ألا يتطابق التعبير العادي مع <code>&quot;123&quot;</code>
testString: 'assert(!pwRegex.test("123"), "Your regex should not match <code>"123"</code>");'
- text: يجب ألا يتطابق التعبير العادي مع <code>&quot;1234&quot;</code>
testString: 'assert(!pwRegex.test("1234"), "Your regex should not match <code>"1234"</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let sampleWord = "astronaut";
let pwRegex = /change/; // Change this line
let result = pwRegex.test(sampleWord);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 587d7dbb367417b2b2512bac
title: Remove Whitespace from Start and End
challengeType: 1
videoUrl: ''
localeTitle: إزالة Whitespace من البداية والنهاية
---
## Description
<section id="description"> في بعض الأحيان لا تكون الأحرف البيضاء حول السلاسل مطلوبة ولكن هناك. المعالجة النموذجية للسلاسل هي إزالة المسافة البيضاء في بداية ونهاية. </section>
## Instructions
<section id="instructions"> اكتب regex واستخدم أساليب السلسلة المناسبة لإزالة المسافات البيضاء في بداية ونهاية السلاسل. <strong>ملحوظة</strong> <br> <code>.trim()</code> طريقة <code>.trim()</code> هنا ، ولكن ستحتاج إلى إكمال هذا التحدي باستخدام التعبيرات العادية. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: 'يجب أن تساوي <code>result</code> <code>&quot;Hello, World!&quot;</code>'
testString: 'assert(result == "Hello, World!", "<code>result</code> should equal to <code>"Hello, World!"</code>");'
- text: يجب عدم استخدام طريقة <code>.trim()</code> .
testString: 'assert(!code.match(/\.trim\(.*?\)/), "You should not use the <code>.trim()</code> method.");'
- text: لا ينبغي تعيين متغير <code>result</code> مساو لسلسلة.
testString: 'assert(!code.match(/result\s*=\s*".*?"/), "The <code>result</code> variable should not be set equal to a string.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let hello = " Hello, World! ";
let wsRegex = /change/; // Change this line
let result = hello; // Change this line
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: 587d7db8367417b2b2512ba2
title: Restrict Possible Usernames
challengeType: 1
videoUrl: ''
localeTitle: تقييد أسماء المستخدمين المحتملين
---
## Description
<section id="description"> يتم استخدام أسماء المستخدمين في كل مكان على الإنترنت. فهي تمنح المستخدمين هوية فريدة على مواقعهم المفضلة. تحتاج إلى التحقق من جميع أسماء المستخدمين في قاعدة بيانات. فيما يلي بعض القواعد البسيطة التي يجب على المستخدمين اتباعها عند إنشاء اسم المستخدم الخاص بهم. 1) يجب أن تكون الأرقام الوحيدة في اسم المستخدم في النهاية. يمكن أن يكون هناك صفر أو أكثر منهم في النهاية. 2) يمكن أن تكون أحرف اسم المستخدم صغيرة وأخرى كبيرة. 3) يجب أن تتكون أسماء المستخدمين من حرفين على الأقل. يمكن لاسم المستخدم المكون من حرفين فقط استخدام أحرف الحروف الأبجدية. </section>
## Instructions
<section id="instructions"> غيّر <code>userCheck</code> لتتوافق مع القيود المدرجة أعلاه. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يتطابق <code>JACK</code> العادي مع <code>JACK</code>
testString: 'assert(userCheck.test("JACK"), "Your regex should match <code>JACK</code>");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>J</code>
testString: 'assert(!userCheck.test("J"), "Your regex should not match <code>J</code>");'
- text: يجب أن يتطابق <code>Oceans11</code> العادي مع <code>Oceans11</code>
testString: 'assert(userCheck.test("Oceans11"), "Your regex should match <code>Oceans11</code>");'
- text: يجب أن يتطابق <code>RegexGuru</code> العادي مع <code>RegexGuru</code>
testString: 'assert(userCheck.test("RegexGuru"), "Your regex should match <code>RegexGuru</code>");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>007</code>
testString: 'assert(!userCheck.test("007"), "Your regex should not match <code>007</code>");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>9</code>
testString: 'assert(!userCheck.test("9"), "Your regex should not match <code>9</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let username = "JackOfAllTrades";
let userCheck = /change/; // Change this line
let result = userCheck.test(username);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,69 @@
---
id: 587d7dbb367417b2b2512baa
title: Reuse Patterns Using Capture Groups
challengeType: 1
videoUrl: ''
localeTitle: إعادة استخدام الأنماط باستخدام مجموعات الالتقاط
---
## Description
<section id="description"> ستحدث بعض الأنماط التي تبحث عنها عدة مرات في سلسلة. من المبدد أن نكرر هذا التعبير المعتاد يدويًا. توجد طريقة أفضل لتحديد عندما يكون لديك سلاسل فرعية متعددة مكررة في السلسلة الخاصة بك. يمكنك البحث عن سلاسل فرعية مكررة باستخدام <code>capture groups</code> . يتم استخدام الأقواس ، <code>(</code> و <code>)</code> ، للعثور على أجزاء فرعية متكررة. يمكنك وضع تعبير النمط الذي سيتكرر بين الأقواس. لتحديد مكان ظهور سلسلة التكرار ، استخدم خط مائل عكسي ( <code>\</code> ) ثم رقمًا. يبدأ هذا الرقم من 1 ويزيد مع كل مجموعة التقاط إضافية تستخدمها. على سبيل المثال سيكون <code>\1</code> لمطابقة المجموعة الأولى. يتطابق المثال أدناه مع أي كلمة تحدث مرتين مفصولة بمسافة: <blockquote style=";text-align:right;direction:rtl"> let repeatStr = &quot;regex regex&quot;؛ <br> اترك repeatRegex = / (\ w +) \ s \ 1 /؛ <br> repeatRegex.test (repeatStr)؛ // يعود صحيح <br> repeatStr.match (repeatRegex)؛ // Returns [&quot;regex regex&quot;، &quot;regex&quot;] </blockquote> باستخدام أسلوب <code>.match()</code> على سلسلة سيعود مصفوفة مع السلسلة يطابق ، جنبا إلى جنب مع مجموعة الالتقاط الخاصة به. </section>
## Instructions
<section id="instructions"> استخدم <code>capture groups</code> في <code>reRegex</code> لمطابقة الأرقام التي يتم تكرارها ثلاث مرات فقط في سلسلة ، كل منها مفصولة بمسافة. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك المنطقي فئة الأحرف المختصرة للأرقام.
testString: 'assert(reRegex.source.match(/\\d/), "Your regex should use the shorthand character class for digits.");'
- text: يجب أن يعيد التعبير المعتاد مجموعة الالتقاط مرتين.
testString: 'assert(reRegex.source.match(/\\\d/g).length === 2, "Your regex should reuse the capture group twice.");'
- text: يجب أن يكون للتعبير العادي منطقتين تفصلان الأرقام الثلاثة.
testString: 'assert(reRegex.source.match(/\\s/g).length === 2, "Your regex should have two spaces separating the three numbers.");'
- text: يجب أن يتطابق تعبيرك العادي مع <code>&quot;42 42 42&quot;</code> .
testString: 'assert(reRegex.test("42 42 42"), "Your regex should match <code>"42 42 42"</code>.");'
- text: يجب أن يتطابق تعبيرك العادي مع <code>&quot;100 100 100&quot;</code> .
testString: 'assert(reRegex.test("100 100 100"), "Your regex should match <code>"100 100 100"</code>.");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>&quot;42 42 42 42&quot;</code> .
testString: 'assert.equal(("42 42 42 42").match(reRegex.source), null, "Your regex should not match <code>"42 42 42 42"</code>.");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>&quot;42 42&quot;</code> .
testString: 'assert.equal(("42 42").match(reRegex.source), null, "Your regex should not match <code>"42 42"</code>.");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>&quot;101 102 103&quot;</code> .
testString: 'assert(!reRegex.test("101 102 103"), "Your regex should not match <code>"101 102 103"</code>.");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>&quot;1 2 3&quot;</code> .
testString: 'assert(!reRegex.test("1 2 3"), "Your regex should not match <code>"1 2 3"</code>.");'
- text: يجب أن يتطابق تعبيرك العادي مع <code>&quot;10 10 10&quot;</code> .
testString: 'assert(reRegex.test("10 10 10"), "Your regex should match <code>"10 10 10"</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let repeatNum = "42 42 42";
let reRegex = /change/; // Change this line
let result = reRegex.test(repeatNum);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: 587d7db9367417b2b2512ba7
title: Specify Exact Number of Matches
challengeType: 1
videoUrl: ''
localeTitle: تحديد العدد الدقيق للمباريات
---
## Description
<section id="description"> يمكنك تحديد العدد السفلي والأعلى من الأنماط مع <code>quantity specifiers</code> باستخدام الأقواس المتعرجة. في بعض الأحيان ، لا تريد سوى عدد محدد من التطابقات. لتحديد عدد معين من الأنماط ، يكون هذا الرقم واحدًا فقط بين الأقواس المتعرجة. على سبيل المثال، لمطابقة فقط كلمة <code>&quot;hah&quot;</code> مع الرسالة <code>a</code> <code>3</code> مرات، من شأنه أن التعابير المنطقية الخاص بك سيكون <code>/ha{3}h/</code> . <blockquote style=";text-align:right;direction:rtl"> اترك A4 = &quot;haaaah&quot;؛ <br> دع A3 = &quot;haaah&quot; ؛ <br> اترك A100 = &quot;h&quot; + &quot;a&quot; .repeat (100) + &quot;h&quot;؛ <br> السماح لـ multipleHA = / ha {3} h /؛ <br> multipleHA.test (A4)؛ // إرجاع خاطئة <br> multipleHA.test (A3)؛ // يعود صحيح <br> multipleHA.test (A100)؛ // إرجاع خاطئة </blockquote></section>
## Instructions
<section id="instructions"> قم بتغيير <code>timRegex</code> regex regex <code>timRegex</code> مع الكلمة <code>&quot;Timber&quot;</code> فقط عندما يكون لها أربعة أحرف <code>m</code> . </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك المعتاد الأقواس المتعرجة.
testString: 'assert(timRegex.source.match(/{.*?}/).length > 0, "Your regex should use curly brackets.");'
- text: يجب ألا يتطابق تعبيرك العادي مع <code>&quot;Timber&quot;</code>
testString: 'assert(!timRegex.test("Timber"), "Your regex should not match <code>"Timber"</code>");'
- text: يجب ألا يتطابق <code>&quot;Timmber&quot;</code> العادي مع <code>&quot;Timmber&quot;</code>
testString: 'assert(!timRegex.test("Timmber"), "Your regex should not match <code>"Timmber"</code>");'
- text: يجب ألا يتطابق <code>&quot;Timmmber&quot;</code> العادي مع <code>&quot;Timmmber&quot;</code>
testString: 'assert(!timRegex.test("Timmmber"), "Your regex should not match <code>"Timmmber"</code>");'
- text: يجب أن يتطابق <code>&quot;Timmmmber&quot;</code> العادي مع <code>&quot;Timmmmber&quot;</code>
testString: 'assert(timRegex.test("Timmmmber"), "Your regex should match <code>"Timmmmber"</code>");'
- text: يجب ألا يتطابق التعبير العادي مع <code>&quot;Timber&quot;</code> مع 30 <code>m</code> في الصورة.
testString: 'assert(!timRegex.test("Ti" + "m".repeat(30) + "ber"), "Your regex should not match <code>"Timber"</code> with 30 <code>m</code>\"s in it.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let timStr = "Timmmmber";
let timRegex = /change/; // Change this line
let result = timRegex.test(timStr);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,63 @@
---
id: 587d7db9367417b2b2512ba6
title: Specify Only the Lower Number of Matches
challengeType: 1
videoUrl: ''
localeTitle: تحديد عدد أقل من المطابقات فقط
---
## Description
<section id="description"> يمكنك تحديد العدد السفلي والأعلى من الأنماط مع <code>quantity specifiers</code> باستخدام الأقواس المتعرجة. في بعض الأحيان ، تحتاج فقط إلى تحديد عدد أقل من الأنماط بدون حد أعلى. لتحديد عدد أقل من الأنماط فقط ، احتفظ بالرقم الأول متبوعًا بفاصلة. على سبيل المثال، لمطابقة فقط سلسلة <code>&quot;hah&quot;</code> مع الرسالة <code>a</code> تظهر ما لا يقل عن <code>3</code> مرات، من شأنه أن التعابير المنطقية الخاص بك سيكون <code>/ha{3,}h/</code> . <blockquote style=";text-align:right;direction:rtl"> اترك A4 = &quot;haaaah&quot;؛ <br> دع A2 = &quot;haah&quot; ؛ <br> اترك A100 = &quot;h&quot; + &quot;a&quot; .repeat (100) + &quot;h&quot;؛ <br> السماح لـ multipleA = / ha {3،} h /؛ <br> multipleA.test (A4)؛ // يعود صحيح <br> multipleA.test (A2)؛ // إرجاع خاطئة <br> multipleA.test (A100)؛ // يعود صحيح </blockquote></section>
## Instructions
<section id="instructions"> تغيير التعبير المعتاد <code>haRegex</code> لتتناسب مع كلمة <code>&quot;Hazzah&quot;</code> فقط عندما يكون لديه أربعة أو أكثر من بريد إلكتروني <code>z</code> الصورة. </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك المعتاد الأقواس المتعرجة.
testString: 'assert(haRegex.source.match(/{.*?}/).length > 0, "Your regex should use curly brackets.");'
- text: يجب ألا يتطابق <code>&quot;Hazzah&quot;</code> العادي مع <code>&quot;Hazzah&quot;</code>
testString: 'assert(!haRegex.test("Hazzah"), "Your regex should not match <code>"Hazzah"</code>");'
- text: يجب ألا يتطابق <code>&quot;Hazzzah&quot;</code> العادي مع <code>&quot;Hazzzah&quot;</code>
testString: 'assert(!haRegex.test("Hazzzah"), "Your regex should not match <code>"Hazzzah"</code>");'
- text: يجب أن يتطابق <code>&quot;Hazzzzah&quot;</code> العادي مع <code>&quot;Hazzzzah&quot;</code>
testString: 'assert(haRegex.test("Hazzzzah"), "Your regex should match <code>"Hazzzzah"</code>");'
- text: يجب أن يتطابق <code>&quot;Hazzzzzah&quot;</code> العادي مع <code>&quot;Hazzzzzah&quot;</code>
testString: 'assert(haRegex.test("Hazzzzzah"), "Your regex should match <code>"Hazzzzzah"</code>");'
- text: يجب أن يتطابق <code>&quot;Hazzzzzzah&quot;</code> العادي مع <code>&quot;Hazzzzzzah&quot;</code>
testString: 'assert(haRegex.test("Hazzzzzzah"), "Your regex should match <code>"Hazzzzzzah"</code>");'
- text: يجب أن يتطابق التعبير العادي مع <code>&quot;Hazzah&quot;</code> مع 30 <code>z</code> \ in.
testString: 'assert(haRegex.test("Ha" + "z".repeat(30) + "ah"), "Your regex should match <code>"Hazzah"</code> with 30 <code>z</code>\"s in it.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let haStr = "Hazzzzah";
let haRegex = /change/; // Change this line
let result = haRegex.test(haStr);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,63 @@
---
id: 587d7db9367417b2b2512ba5
title: Specify Upper and Lower Number of Matches
challengeType: 1
videoUrl: ''
localeTitle: تحديد العلوي والسفلي عدد من المباريات
---
## Description
<section id="description"> أذكر أنك تستخدم علامة الجمع <code>+</code> للبحث عن حرف واحد أو أكثر والعلامة النجمية <code>*</code> للبحث عن صفر أو أكثر من الأحرف. هذه هي مريحة ولكن في بعض الأحيان تريد أن تتطابق مع مجموعة معينة من الأنماط. يمكنك تحديد العدد السفلي والعلوي من الأنماط مع <code>quantity specifiers</code> . يتم استخدام محددات الكمية مع الأقواس المتعرجة ( <code>{</code> و <code>}</code> ). يمكنك وضع رقمين بين الأقواس المتعرجة - للعدد السفلي والأعلى من الأنماط. على سبيل المثال، لمطابقة فقط الرسالة <code>a</code> التي تظهر بين <code>3</code> و <code>5</code> مرات في سلسلة <code>&quot;ah&quot;</code> ، رجإكس الخاص سيكون <code>/a{3,5}h/</code> . <blockquote style=";text-align:right;direction:rtl"> اترك A4 = &quot;aaaah&quot; ؛ <br> دع A2 = &quot;aah&quot; ؛ <br> السماح لـ multipleA = / a {3،5} h /؛ <br> multipleA.test (A4)؛ // يعود صحيح <br> multipleA.test (A2)؛ // إرجاع خاطئة </blockquote></section>
## Instructions
<section id="instructions"> تغيير التعبير المعتاد <code>ohRegex</code> لمباراة فقط <code>3</code> إلى <code>6</code> إلكتروني <code>h</code> الصورة في كلمة <code>&quot;Oh no&quot;</code> . </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب أن يستخدم تعبيرك المعتاد الأقواس المتعرجة.
testString: 'assert(ohRegex.source.match(/{.*?}/).length > 0, "Your regex should use curly brackets.");'
- text: يجب ألا يتطابق <code>&quot;Ohh no&quot;</code> العادي مع <code>&quot;Ohh no&quot;</code>
testString: 'assert(!ohRegex.test("Ohh no"), "Your regex should not match <code>"Ohh no"</code>");'
- text: يجب أن يتطابق <code>&quot;Ohhh no&quot;</code> المعتاد مع <code>&quot;Ohhh no&quot;</code>
testString: 'assert(ohRegex.test("Ohhh no"), "Your regex should match <code>"Ohhh no"</code>");'
- text: يجب أن يتطابق <code>&quot;Ohhhh no&quot;</code> المعتاد مع <code>&quot;Ohhhh no&quot;</code>
testString: 'assert(ohRegex.test("Ohhhh no"), "Your regex should match <code>"Ohhhh no"</code>");'
- text: يجب أن يتطابق <code>&quot;Ohhhhh no&quot;</code> العادي مع <code>&quot;Ohhhhh no&quot;</code>
testString: 'assert(ohRegex.test("Ohhhhh no"), "Your regex should match <code>"Ohhhhh no"</code>");'
- text: يجب أن يتطابق <code>&quot;Ohhhhhh no&quot;</code> المعتاد مع <code>&quot;Ohhhhhh no&quot;</code>
testString: 'assert(ohRegex.test("Ohhhhhh no"), "Your regex should match <code>"Ohhhhhh no"</code>");'
- text: يجب ألا يتطابق <code>&quot;Ohhhhhhh no&quot;</code> العادي مع <code>&quot;Ohhhhhhh no&quot;</code>
testString: 'assert(!ohRegex.test("Ohhhhhhh no"), "Your regex should not match <code>"Ohhhhhhh no"</code>");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let ohStr = "Ohhh no";
let ohRegex = /change/; // Change this line
let result = ohRegex.test(ohStr);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,56 @@
---
id: 587d7dbb367417b2b2512bab
title: Use Capture Groups to Search and Replace
challengeType: 1
videoUrl: ''
localeTitle: استخدم مجموعات الالتقاط للبحث واستبدال
---
## Description
<section id="description"> البحث مفيد. ومع ذلك ، يمكنك جعل البحث أكثر قوة عندما يتغير (أو يحل محل) النص الذي تطابقه. يمكنك البحث واستبدال النص في سلسلة باستخدام <code>.replace()</code> في سلسلة. تعتبر مدخلات <code>.replace()</code> هي أولاً نمط regex الذي تريد البحث عنه. المعلمة الثانية هي السلسلة التي ستحل محل المطابقة أو الوظيفة لفعل شيء ما. <blockquote style=";text-align:right;direction:rtl"> let wrongText = &quot;إن السماء فضية.&quot;؛ <br> let silverRegex = / silver /؛ <br> wrongText.replace (silverRegex، &quot;blue&quot;<br> // Returns &quot;السماء زرقاء.&quot; </blockquote> يمكنك أيضًا الوصول إلى مجموعات الالتقاط في سلسلة الاستبدال باستخدام علامة الدولار ( <code>$</code> ). <blockquote style=";text-align:right;direction:rtl"> &quot;Code Code&quot; .replace (/ (\ w +) \ s (\ w +) /، &#39;$ 2 $ 1&#39;<br> // إرجاع &quot;رمز المعسكر&quot; </blockquote></section>
## Instructions
<section id="instructions"> اكتب تعبيرًا منطقيًا حتى يبحث عن السلسلة <code>&quot;good&quot;</code> . ثم قم بتحديث متغير <code>replaceText</code> لاستبدال <code>&quot;good&quot;</code> بـ <code>&quot;okey-dokey&quot;</code> . </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب عليك استخدام <code>.replace()</code> للبحث <code>.replace()</code> .
testString: 'assert(code.match(/\.replace\(.*\)/), "You should use <code>.replace()</code> to search and replace.");'
- text: يجب أن يتغير تعبيرك المعتاد <code>&quot;This sandwich is good.&quot;</code> إلى <code>&quot;This sandwich is okey-dokey.&quot;</code>
testString: 'assert(result == "This sandwich is okey-dokey." && replaceText === "okey-dokey", "Your regex should change <code>"This sandwich is good."</code> to <code>"This sandwich is okey-dokey."</code>");'
- text: يجب عدم تغيير السطر الأخير.
testString: 'assert(code.match(/result\s*=\s*huhText\.replace\(.*?\)/), "You should not change the last line.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let huhText = "This sandwich is good.";
let fixRegex = /change/; // Change this line
let replaceText = ""; // Change this line
let result = huhText.replace(fixRegex, replaceText);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,53 @@
---
id: 587d7db3367417b2b2512b8e
title: Using the Test Method
challengeType: 1
videoUrl: ''
localeTitle: باستخدام طريقة الاختبار
---
## Description
<section id="description"> يتم استخدام التعبيرات العادية في لغات البرمجة لمطابقة أجزاء من السلاسل. يمكنك إنشاء أنماط لمساعدتك في إجراء ذلك المطابقة. إذا كنت تريد العثور على الكلمة <code>&quot;the&quot;</code> في السلسلة <code>&quot;The dog chased the cat&quot;</code> ، يمكنك استخدام التعبير العادي التالي: <code>/the/</code> . لاحظ أن علامات الاقتباس ليست مطلوبة في التعبير العادي. جافا سكريبت لديها طرق متعددة لاستخدام regexes. طريقة واحدة لاختبار regex تستخدم طريقة <code>.test()</code> . و <code>.test()</code> يأخذ طريقة التعبير المعتاد، وينطبق ذلك إلى سلسلة (التي يتم وضعها داخل قوسين)، وإرجاع <code>true</code> أو <code>false</code> إذا وجد النمط الخاص بك شيئا أم لا. <blockquote style=";text-align:right;direction:rtl"> السماح testStr = &quot;freeCodeCamp&quot; ؛ <br> let testRegex = / Code /؛ <br> testRegex.test (testStr)؛ <br> // يعود صحيح </blockquote></section>
## Instructions
<section id="instructions"> قم <code>myRegex</code> regex على السلسلة <code>myString</code> باستخدام طريقة <code>.test()</code> . </section>
## Tests
<section id='tests'>
```yml
tests:
- text: يجب عليك استخدام <code>.test()</code> لاختبار regex.
testString: 'assert(code.match(/myRegex.test\(\s*myString\s*\)/), "You should use <code>.test()</code> to test the regex.");'
- text: نتيجة الخاص بك يجب أن تعود <code>true</code> .
testString: 'assert(result === true, "Your result should return <code>true</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
let myString = "Hello, World!";
let myRegex = /Hello/;
let result = myRegex; // Change this line
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>