محتوى الدورة
Learn JavaScript in Arabic 2021
وصف الدرس

ال Code

/*
  Regular Expression

  Quantifiers
  n{x}   => Number of
  n{x,y} => Range
  n{x,}  => At Least x
*/

let serials = "S100S S3000S S50000S S950000S";

console.log(serials.match(/sd{3}s/ig)); // S[Three Number]S
console.log(serials.match(/sd{4,5}s/ig)); // S[Four Or Five Number]S
console.log(serials.match(/sd{4,}s/ig)); // S[At Least Four]S