2.8 KiB
2.8 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d7db5367417b2b2512b96 | Match Letters of the Alphabet | 1 | تطابق حروف الأبجدية |
Description
character sets
لتحديد مجموعة من الأحرف لمطابقة ، ولكن هذا كثير من الكتابة عندما تحتاج إلى مطابقة مجموعة كبيرة من الأحرف (على سبيل المثال ، كل حرف في الأبجدية). لحسن الحظ ، هناك ميزة مضمنة تجعل هذا قصيرة وبسيطة. داخل مجموعة character set
، يمكنك تحديد نطاق من الأحرف لمطابقة أحرف hyphen
: -
. على سبيل المثال ، لمطابقة الأحرف الصغيرة a
خلال e
قد تستخدم [ae]
. دع catStr = "قطة" ؛
السماح batStr = "الخفافيش" ؛
السماح matStr = "حصيرة" ؛
let bgRegex = / [ae] at /؛
catStr.match (bgRegex)؛ // Returns ["cat"]
batStr.match (bgRegex)؛ // Returns ["bat"]
matStr.match (bgRegex)؛ // يعود لاغيا
Instructions
quoteSample
. ملحوظة تأكد من مطابقة الأحرف الكبيرة والصغيرة .
Tests
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.");'
Challenge Seed
let quoteSample = "The quick brown fox jumps over the lazy dog.";
let alphabetRegex = /change/; // Change this line
let result = alphabetRegex; // Change this line
Solution
// solution required