Skip to main content
Commonmark migration
Source Link

#JavaScript (ES6), 53 bytes

JavaScript (ES6), 53 bytes

Derived from the regular expression used by @wastl in Is it double speak?.

s=>[...s].some((_,n)=>s.match(`^((.)\\2{${++n}})*$`)) 

Try it online!


#Recursive version, 55 bytes

Recursive version, 55 bytes

s=>(g=n=>s[++n]&&!!s.match(`^((.)\\2{${n}})*$`)|g(n))`` 

Try it online!

###Commented

Commented

s => ( // s = input string g = n => // g is a recursive function taking a repetition length n s[++n] && // increment n; abort if s[n] is not defined !!s.match( // otherwise, test whether s consists of groups of: `^((.)\\2{${n}})*$` // some character, followed by n copies of the same character ) // | g(n) // or whether it works for some greater n )`` // initial call to g with n = [''] (zero-ish) 

#JavaScript (ES6), 53 bytes

Derived from the regular expression used by @wastl in Is it double speak?.

s=>[...s].some((_,n)=>s.match(`^((.)\\2{${++n}})*$`)) 

Try it online!


#Recursive version, 55 bytes

s=>(g=n=>s[++n]&&!!s.match(`^((.)\\2{${n}})*$`)|g(n))`` 

Try it online!

###Commented

s => ( // s = input string g = n => // g is a recursive function taking a repetition length n s[++n] && // increment n; abort if s[n] is not defined !!s.match( // otherwise, test whether s consists of groups of: `^((.)\\2{${n}})*$` // some character, followed by n copies of the same character ) // | g(n) // or whether it works for some greater n )`` // initial call to g with n = [''] (zero-ish) 

JavaScript (ES6), 53 bytes

Derived from the regular expression used by @wastl in Is it double speak?.

s=>[...s].some((_,n)=>s.match(`^((.)\\2{${++n}})*$`)) 

Try it online!


Recursive version, 55 bytes

s=>(g=n=>s[++n]&&!!s.match(`^((.)\\2{${n}})*$`)|g(n))`` 

Try it online!

Commented

s => ( // s = input string g = n => // g is a recursive function taking a repetition length n s[++n] && // increment n; abort if s[n] is not defined !!s.match( // otherwise, test whether s consists of groups of: `^((.)\\2{${n}})*$` // some character, followed by n copies of the same character ) // | g(n) // or whether it works for some greater n )`` // initial call to g with n = [''] (zero-ish) 
added a shorter non-recursive version
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

#JavaScript (ES6), 5553 bytes

Derived from the regular expression used by @wastl in Is it double speak?.

s=>[...s].some((_,n)=>s.match(`^((.)\\2{${++n}})*$`)) 

Try it online!


#Recursive version, 55 bytes

s=>(g=n=>s[++n]&&!!s.match(`^((.)\\2{${n}})*$`)|g(n))`` 

Try it online!

###Commented

s => ( // s = input string g = n => // g is a recursive function taking a repetition length n s[++n] && // increment n; abort if s[n] is not defined !!s.match( // otherwise, test whether s consists of groups of: `^((.)\\2{${n}})*$` // some character, followed by n copies of the same character ) // | g(n) // or whether it works for some greater n )`` // initial call to g with n = [''] (zero-ish) 

#JavaScript (ES6), 55 bytes

Derived from the regular expression used by @wastl in Is it double speak?.

s=>(g=n=>s[++n]&&!!s.match(`^((.)\\2{${n}})*$`)|g(n))`` 

Try it online!

###Commented

s => ( // s = input string g = n => // g is a recursive function taking a repetition length n s[++n] && // increment n; abort if s[n] is not defined !!s.match( // otherwise, test whether s consists of groups of: `^((.)\\2{${n}})*$` // some character, followed by n copies of the same character ) // | g(n) // or whether it works for some greater n )`` // initial call to g with n = [''] (zero-ish) 

#JavaScript (ES6), 53 bytes

Derived from the regular expression used by @wastl in Is it double speak?.

s=>[...s].some((_,n)=>s.match(`^((.)\\2{${++n}})*$`)) 

Try it online!


#Recursive version, 55 bytes

s=>(g=n=>s[++n]&&!!s.match(`^((.)\\2{${n}})*$`)|g(n))`` 

Try it online!

###Commented

s => ( // s = input string g = n => // g is a recursive function taking a repetition length n s[++n] && // increment n; abort if s[n] is not defined !!s.match( // otherwise, test whether s consists of groups of: `^((.)\\2{${n}})*$` // some character, followed by n copies of the same character ) // | g(n) // or whether it works for some greater n )`` // initial call to g with n = [''] (zero-ish) 
added a commented version
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670

#JavaScript (ES6), 55 bytes

Derived from the regular expression used by @wastl in Is it double speak?.

s=>(g=n=>s[++n]&&!!s.match(`^((.)\\2{${n}})*$`)|g(n))`` 

Try it online!Try it online!

###Commented

s => ( // s = input string g = n => // g is a recursive function taking a repetition length n s[++n] && // increment n; abort if s[n] is not defined !!s.match( // otherwise, test whether s consists of groups of: `^((.)\\2{${n}})*$` // some character, followed by n copies of the same character ) // | g(n) // or whether it works for some greater n )`` // initial call to g with n = [''] (zero-ish) 

#JavaScript (ES6), 55 bytes

Derived from the regular expression used by @wastl in Is it double speak?.

s=>(g=n=>s[++n]&&!!s.match(`^((.)\\2{${n}})*$`)|g(n))`` 

Try it online!

#JavaScript (ES6), 55 bytes

Derived from the regular expression used by @wastl in Is it double speak?.

s=>(g=n=>s[++n]&&!!s.match(`^((.)\\2{${n}})*$`)|g(n))`` 

Try it online!

###Commented

s => ( // s = input string g = n => // g is a recursive function taking a repetition length n s[++n] && // increment n; abort if s[n] is not defined !!s.match( // otherwise, test whether s consists of groups of: `^((.)\\2{${n}})*$` // some character, followed by n copies of the same character ) // | g(n) // or whether it works for some greater n )`` // initial call to g with n = [''] (zero-ish) 
Source Link
Arnauld
  • 205.5k
  • 21
  • 187
  • 670
Loading