5 added 51 characters in body
source | link

Regex (ECMAScript flavour), 11 bytes

Sounds like a job for regex!

^([^]+)\1+$

Test it here.

I've chosen ECMAScript, because it's the only flavour (I know) in which [^] matches any character. In all others, I'd either need a flag to change the behaviour of . or use [\s\S] which is three characters longer.

Depending on how we're counting the flag, that could of course be a byte shorter. E.g. if we're counting pattern + flags (e.g. ignoring delimiters), the PCRE/Perl equivalent would be

/^(.+)\1+$/s

Which is 10 bytes, ignoring the delimiters.

Test it here.

This matches only strings which consist of at least two repetitions of some substring.

Here is a full 26-byte ES6 function, but I maintain that regular expression submissions are generally valid:

f=s->/^([^]+)\1+$/.test(s)

Regex (ECMAScript flavour), 11 bytes

Sounds like a job for regex!

^([^]+)\1+$

Test it here.

I've chosen ECMAScript, because it's the only flavour (I know) in which [^] matches any character. In all others, I'd either need a flag to change the behaviour of . or use [\s\S] which is three characters longer.

Depending on how we're counting the flag, that could of course be a byte shorter. E.g. if we're counting pattern + flags (e.g. ignoring delimiters), the PCRE/Perl equivalent would be

/^(.+)\1+$/s

Which is 10 bytes, ignoring the delimiters.

This matches only strings which consist of at least two repetitions of some substring.

Here is a full 26-byte ES6 function, but I maintain that regular expression submissions are generally valid:

f=s->/^([^]+)\1+$/.test(s)

Regex (ECMAScript flavour), 11 bytes

Sounds like a job for regex!

^([^]+)\1+$

Test it here.

I've chosen ECMAScript, because it's the only flavour (I know) in which [^] matches any character. In all others, I'd either need a flag to change the behaviour of . or use [\s\S] which is three characters longer.

Depending on how we're counting the flag, that could of course be a byte shorter. E.g. if we're counting pattern + flags (e.g. ignoring delimiters), the PCRE/Perl equivalent would be

/^(.+)\1+$/s

Which is 10 bytes, ignoring the delimiters.

Test it here.

This matches only strings which consist of at least two repetitions of some substring.

Here is a full 26-byte ES6 function, but I maintain that regular expression submissions are generally valid:

f=s->/^([^]+)\1+$/.test(s)
4 edited body
source | link

Regex (ECMAScript flavour), 11 bytes

Sounds like a job for regex!

^([^]+)\1+$

Test it here.

I've chosen ECMAScript, because it's the only flavour (I know) in which [^] matches any character. In all others, I'd either need a flag to change the behaviour of s. or use [\s\S] which is three characters longer.

Depending on how we're counting the flag, that could of course be a byte shorter. E.g. if we're counting pattern + flags (e.g. ignoring delimiters), the PCRE/Perl equivalent would be

/^(.+)\1+$/s

Which is 10 bytes, ignoring the delimiters.

This matches only strings which consist of at least two repetitions of some substring.

Here is a full 26-byte ES6 function, but I maintain that regular expression submissions are generally valid:

f=s->/^([^]+)\1+$/.test(s)

Regex (ECMAScript flavour), 11 bytes

Sounds like a job for regex!

^([^]+)\1+$

Test it here.

I've chosen ECMAScript, because it's the only flavour (I know) in which [^] matches any character. In all others, I'd either need a flag to change the behaviour of s or use [\s\S] which is three characters longer.

Depending on how we're counting the flag, that could of course be a byte shorter. E.g. if we're counting pattern + flags (e.g. ignoring delimiters), the PCRE/Perl equivalent would be

/^(.+)\1+$/s

Which is 10 bytes, ignoring the delimiters.

This matches only strings which consist of at least two repetitions of some substring.

Here is a full 26-byte ES6 function, but I maintain that regular expression submissions are generally valid:

f=s->/^([^]+)\1+$/.test(s)

Regex (ECMAScript flavour), 11 bytes

Sounds like a job for regex!

^([^]+)\1+$

Test it here.

I've chosen ECMAScript, because it's the only flavour (I know) in which [^] matches any character. In all others, I'd either need a flag to change the behaviour of . or use [\s\S] which is three characters longer.

Depending on how we're counting the flag, that could of course be a byte shorter. E.g. if we're counting pattern + flags (e.g. ignoring delimiters), the PCRE/Perl equivalent would be

/^(.+)\1+$/s

Which is 10 bytes, ignoring the delimiters.

This matches only strings which consist of at least two repetitions of some substring.

Here is a full 26-byte ES6 function, but I maintain that regular expression submissions are generally valid:

f=s->/^([^]+)\1+$/.test(s)
3 added 255 characters in body
source | link

Regex (ECMAScript flavour), 11 bytes

Sounds like a job for regex!

^([^]+)\1+$

Test it here.

I've chosen ECMAScript, because it's the only flavour (I know) in which [^] matches any character. In all others, I'd either need a flag to change the behaviour of s or use [\s\S] which is three characters longer.

Depending on how we're counting the flag, that could of course be a byte shorter. E.g. if we're counting pattern + flags (e.g. ignoring delimiters), the PCRE/Perl equivalent would be

/^(.+)\1+$/s

Which is 10 bytes, ignoring the delimiters.

This matches only strings which consist of at least two repetitions of some substring.

Here is a full 26-byte ES6 function, but I maintain that regular expression submissions are generally valid:

f=s->/^([^]+)\1+$/.test(s)

Regex (ECMAScript flavour), 11 bytes

Sounds like a job for regex!

^([^]+)\1+$

Test it here.

I've chosen ECMAScript, because it's the only flavour (I know) in which [^] matches any character. In all others, I'd either need a flag to change the behaviour of s or use [\s\S] which is three characters longer.

This matches only strings which consist of at least two repetitions of some substring.

Here is a full 26-byte ES6 function, but I maintain that regular expression submissions are generally valid:

f=s->/^([^]+)\1+$/.test(s)

Regex (ECMAScript flavour), 11 bytes

Sounds like a job for regex!

^([^]+)\1+$

Test it here.

I've chosen ECMAScript, because it's the only flavour (I know) in which [^] matches any character. In all others, I'd either need a flag to change the behaviour of s or use [\s\S] which is three characters longer.

Depending on how we're counting the flag, that could of course be a byte shorter. E.g. if we're counting pattern + flags (e.g. ignoring delimiters), the PCRE/Perl equivalent would be

/^(.+)\1+$/s

Which is 10 bytes, ignoring the delimiters.

This matches only strings which consist of at least two repetitions of some substring.

Here is a full 26-byte ES6 function, but I maintain that regular expression submissions are generally valid:

f=s->/^([^]+)\1+$/.test(s)
2 added 146 characters in body
source | link
1
source | link