Skip to main content
deleted 111 characters in body
Source Link
FryAmTheEggman
  • 17.5k
  • 3
  • 39
  • 97

Retina, 22 11

\d+
$0$*1
1

Try it online!

11 bytes (!) saved thanks to Martin!

Basically just decimal to unary then count the 1s.

Retina, 22 11

\d+
$0$*1
1

11 bytes (!) saved thanks to Martin!

Basically just decimal to unary then count the 1s.

Retina, 22 11

\d+
$0$*1
1

Try it online!

11 bytes (!) saved thanks to Martin!

Basically just decimal to unary then count the 1s.

deleted 236 characters in body
Source Link
FryAmTheEggman
  • 17.5k
  • 3
  • 39
  • 97

Retina, 2222 11

\d+
$0$*1
((1)|.)+
$#2

Try it online!

or same length:

\d+
$0$*1
\D

(1)+
$#1

Try it online!11 bytes (!) saved thanks to Martin!

Basically just decimal to unary then count the 1s. The difference between the two is whether it removes the other characters or just doesn't count them. I feel particularly like the first one is golfable?

Retina, 22

\d+
$0$*1
((1)|.)+
$#2

Try it online!

or same length:

\d+
$0$*1
\D

(1)+
$#1

Try it online!

Basically just decimal to unary then count the 1s. The difference between the two is whether it removes the other characters or just doesn't count them. I feel particularly like the first one is golfable?

Retina, 22 11

\d+
$0$*1
1

11 bytes (!) saved thanks to Martin!

Basically just decimal to unary then count the 1s.

Source Link
FryAmTheEggman
  • 17.5k
  • 3
  • 39
  • 97

Retina, 22

\d+
$0$*1
((1)|.)+
$#2

Try it online!

or same length:

\d+
$0$*1
\D

(1)+
$#1

Try it online!

Basically just decimal to unary then count the 1s. The difference between the two is whether it removes the other characters or just doesn't count them. I feel particularly like the first one is golfable?