I'm pretty sure it's impossible to do 2 repetitions in Perl/PCRE, because [^] is not available (except with the PCRE2_ALLOW_EMPTY_CLASS flag), and the only other alternatives use \ – for example \C, \N, \X, \S, and [^0円]. So, with 3 repetitions:
I'm pretty sure it's impossible to do 2 repetitions in Perl/PCRE, because [^] is not available (except with the PCRE2_ALLOW_EMPTY_CLASS flag), and the only other alternatives use \ – for example \N, \X, \S, and [^0円]. So, with 3 repetitions:
I'm pretty sure it's impossible to do 2 repetitions in Perl/PCRE, because [^] is not available (except with the PCRE2_ALLOW_EMPTY_CLASS flag), and the only other alternatives use \ – for example \C, \N, \X, \S, and [^0円]. So, with 3 repetitions:
I'm pretty sure it's impossible to do 2 repetitions in Perl/PCRE, because [^] is not available (except with the PCRE2_ALLOW_EMPTY_CLASS flag), and the only other alternatives areuse \ – for example \N and, \X, both of which use \\S, and [^0円]. So, with 3 repetitions:
I'm pretty sure it's impossible to do 2 repetitions in Perl/PCRE, because [^] is not available (except with the PCRE2_ALLOW_EMPTY_CLASS flag), and the only other alternatives are \N and \X, both of which use \. So, with 3 repetitions:
I'm pretty sure it's impossible to do 2 repetitions in Perl/PCRE, because [^] is not available (except with the PCRE2_ALLOW_EMPTY_CLASS flag), and the only other alternatives use \ – for example \N, \X, \S, and [^0円]. So, with 3 repetitions:
Perl / PCRE, 57 bytes
I'm pretty sure it's impossible to do 2 repetitions in Perl/PCRE, because [^] is not available (except with the PCRE2_ALLOW_EMPTY_CLASS flag), and the only other alternatives are \N and \X, both of which use \. So, with 3 repetitions:
^(?!(.)*(.*1円){3})[[[-\]\]^^??!!'''-*.11{335577}$$-]{57}$
This is very similar to jimmy23013's JavaScript solution . It doesn't work under JavaScript however, because ^(?!(.)*(.*1円){3}) can always match on any string; it would capture an unset 1円 by doing zero repetitions on (.)*, and then 1円 would match an empty string 3 times.
Making it portable to both JavaScript and Perl/PCRE by using (.)+ instead of (.)* would end up making it 60 bytes, due to adding the + character.
Alternatively:
((.)+(.*2円){3})?+^[[[-\]\]^^??+'''-**.22{335577}$$-]{57}$
This uses the possessive quantifier ?+ to atomically try to match a character repeated 4 times. If such a match is not found, it will be forced to do zero repeats (instead of one) and the ^ will match. Otherwise it will match something non-empty, and the ^ won't match.
Perl / PCRE, 57 bytes
I'm pretty sure it's impossible to do 2 repetitions in Perl/PCRE, because [^] is not available (except with the PCRE2_ALLOW_EMPTY_CLASS flag), and the only other alternatives are \N and \X, both of which use \. So, with 3 repetitions:
^(?!(.)*(.*1円){3})[[[-\]\]^^??!!'''-*.11{335577}$$-]{57}$
This is very similar to jimmy23013's JavaScript solution . It doesn't work under JavaScript however, because ^(?!(.)*(.*1円){3}) can always match on any string; it would capture an unset 1円 by doing zero repetitions on (.)*, and then 1円 would match an empty string 3 times.
Making it portable to both JavaScript and Perl/PCRE by using (.)+ instead of (.)* would end up making it 60 bytes, due to adding the + character.
Alternatively:
((.)+(.*2円){3})?+^[[[-\]\]^^??+'''-**.22{335577}$$-]{57}$
This uses the possessive quantifier ?+ to atomically try to match a character repeated 4 times. If such a match is not found, it will be forced to do zero repeats (instead of one) and the ^ will match. Otherwise it will match something non-empty, and the ^ won't match.
- 12.9k
- 2
- 71
- 55