Skip to main content
saved 1 byte and added a commented version
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (ES6),  89 ... 8684  8483 bytes / chars

s=>s[S='split']` `.map(s=>t+=([m,M,c]=s[S](/\W+\W/),k=s[S](c).length-2)>=m&k<=M,t=0)|t 

Try it online!Try it online!

Commented

s => // s = input string s[S = 'split']`\n` // split it on line-feeds .map(s => // for each line s: t += // update t: ( [m, M, c] = // [m, M, c] = [min, max, char] obtained by ... s[S](/\W/), // ... splitting s on non-alphanumerical characters k = s[S](c) // k = number of occurrences of c in s, minus 1 .length - 2 // (so we have to subtract 2 from the length of the array) ) >= m & // increment t if k is greater than or equal to m k <= M, // and less than or equal to M t = 0 // starting with t = 0 ) | t // end of map(); return t 

JavaScript (ES6),  89 ... 86  84 bytes / chars

s=>s[S='split']` `.map(s=>t+=([m,M,c]=s[S](/\W+/),k=s[S](c).length-2)>=m&k<=M,t=0)|t 

Try it online!

JavaScript (ES6),  89 ... 84  83 bytes / chars

s=>s[S='split']` `.map(s=>t+=([m,M,c]=s[S](/\W/),k=s[S](c).length-2)>=m&k<=M,t=0)|t 

Try it online!

Commented

s => // s = input string s[S = 'split']`\n` // split it on line-feeds .map(s => // for each line s: t += // update t: ( [m, M, c] = // [m, M, c] = [min, max, char] obtained by ... s[S](/\W/), // ... splitting s on non-alphanumerical characters k = s[S](c) // k = number of occurrences of c in s, minus 1 .length - 2 // (so we have to subtract 2 from the length of the array) ) >= m & // increment t if k is greater than or equal to m k <= M, // and less than or equal to M t = 0 // starting with t = 0 ) | t // end of map(); return t 
saved 2 bytes
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (ES6),  89 88 87... 86  8684 bytes / chars

Now expects a single string.

s=>ss=>s[S='split']` `.replace(/(\d*)-(\d*) map(.).*/g,s=>t+=(s,m[m,M,c)=>t+=c]=s[S](k=s.split/\W+/),k=s[S](c).length-2)>=m&k<=M,t=0)|t 

Try it online!Try it online!

JavaScript (ES6),  89 88 87  86 bytes

Now expects a single string.

s=>s.replace(/(\d*)-(\d*) (.).*/g,(s,m,M,c)=>t+=(k=s.split(c).length-2)>=m&k<=M,t=0)|t 

Try it online!

JavaScript (ES6),  89 ... 86  84 bytes / chars

s=>s[S='split']` `.map(s=>t+=([m,M,c]=s[S](/\W+/),k=s[S](c).length-2)>=m&k<=M,t=0)|t 

Try it online!

saved 1 byte
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

JavaScript (ES6),  89 88 87  8786 bytes

Now expects a single string.

s=>s.replace(/(\d*)-(\d*) (.*).*/g,(_s,m,M,sc)=>t+=(k=s.split(s[1]c).length-2)>=m&k<=M,t=0)|t 

Try it online!Try it online!

JavaScript (ES6),  89 88  87 bytes

Now expects a single string.

s=>s.replace(/(\d*)-(\d*)(.*)/g,(_,m,M,s)=>t+=(k=s.split(s[1]).length-2)>=m&k<=M,t=0)|t 

Try it online!

JavaScript (ES6),  89 88 87  86 bytes

Now expects a single string.

s=>s.replace(/(\d*)-(\d*) (.).*/g,(s,m,M,c)=>t+=(k=s.split(c).length-2)>=m&k<=M,t=0)|t 

Try it online!

saved 1 byte
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670
Loading
saved 1 byte
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670
Loading
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670
Loading