freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-an.../regular-expressions/match-numbers-and-letters-o...

2.3 KiB

id title challengeType videoUrl localeTitle
587d7db5367417b2b2512b97 Match Numbers and Letters of the Alphabet 1 أرقام المباراة ورسائل الأبجدية

Description

لا يقتصر استخدام الواصلة ( - ) لمطابقة نطاق من الأحرف على الأحرف. كما يعمل على مطابقة مجموعة من الأرقام. على سبيل المثال ، /[0-5]/ تطابق أي رقم بين 0 و 5 ، بما في ذلك 0 و 5 . أيضا ، من الممكن الجمع بين مجموعة من الحروف والأرقام في مجموعة أحرف واحدة.
let jennyStr = "Jenny8675309"؛
let myRegex = / [a-z0-9] / ig؛
// تطابق جميع الحروف والأرقام في jennyStr
jennyStr.match (myRegex)؛

Instructions

أنشئ تعبيرًا واحدًا يتطابق مع نطاق من الأحرف بين h و s ومجموعة من الأرقام بين 2 و 6 . تذكر تضمين الأعلام المناسبة في التعابير المنطقية.

Tests

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

Challenge Seed

let quoteSample = "Blueberry 3.141592653s are delicious.";
let myRegex = /change/; // Change this line
let result = myRegex; // Change this line

Solution

// solution required