freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-an.../regular-expressions/match-all-non-numbers.arabi...

3.4 KiB

id title challengeType videoUrl localeTitle
587d7db8367417b2b2512ba1 Match All Non-Numbers 1 المباراة جميع غير الارقام

Description

أظهر التحدي الأخير كيفية البحث عن الأرقام باستخدام الاختصار \d باستخدام أحرف صغيرة d . يمكنك أيضًا البحث عن غير أرقام باستخدام اختصار مماثل يستخدم حرف D كبيرًا بدلاً من ذلك. الاختصار للبحث عن أحرف غير رقمية هو \D هذا يساوي فئة الأحرف [^0-9] ، والتي تبحث عن حرف واحد ليس رقمًا بين الصفر والتاسع.

Instructions

استخدم فئة حرف الاختصار غير digits \D لحساب عدد غير أرقام في عناوين الأفلام.

Tests

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>.");'

Challenge Seed

let numString = "Your sandwich will be $5.00";
let noNumRegex = /change/; // Change this line
let result = numString.match(noNumRegex).length;

Solution

// solution required