Skip to main content
deleted 288 characters in body
Source Link
pajonk
  • 18.3k
  • 3
  • 25
  • 74

R, 64 5858 57 bytes

Edit: -1 byte thanks to @Dominic van Essen.

\(x){regmatches(x,t)<-Map=Map(attr,t<-gregexpr("0+",x),"m")
x}

Attempt This Online!

Or as a one-liner:

\(x)`regmatches<-`(x,t<-gregexpr("0+",x),,Map(attr,t,"m"))

Attempt This Online!Attempt This Online!

R has some weird string manipulation functions...

R, 64 58 bytes

\(x){regmatches(x,t)<-Map(attr,t<-gregexpr("0+",x),"m")
x}

Attempt This Online!

Or as a one-liner:

\(x)`regmatches<-`(x,t<-gregexpr("0+",x),,Map(attr,t,"m"))

Attempt This Online!

R has some weird string manipulation functions...

R, 64 58 57 bytes

Edit: -1 byte thanks to @Dominic van Essen.

\(x){regmatches(x,t)=Map(attr,t<-gregexpr("0+",x),"m")
x}

Attempt This Online!

R has some weird string manipulation functions...

deleted 11 characters in body
Source Link
pajonk
  • 18.3k
  • 3
  • 25
  • 74

R, 6464 58 bytes

\(x){regmatches(x,t)<-listMap(attr(el(,t<-gregexpr("0+",x)),"m"))
x}

Attempt This Online!Attempt This Online!

Or as a one-liner:

\(x)`regmatches<-`(x,t<-gregexpr("0+",x),,listMap(attr(el(,t),"m")))

Attempt This Online!Attempt This Online!

R has some weird string manipulation functions...

R, 64 bytes

\(x){regmatches(x,t)<-list(attr(el(t<-gregexpr("0+",x)),"m"))
x}

Attempt This Online!

Or as a one-liner:

\(x)`regmatches<-`(x,t<-gregexpr("0+",x),,list(attr(el(t),"m")))

Attempt This Online!

R has some weird string manipulation functions...

R, 64 58 bytes

\(x){regmatches(x,t)<-Map(attr,t<-gregexpr("0+",x),"m")
x}

Attempt This Online!

Or as a one-liner:

\(x)`regmatches<-`(x,t<-gregexpr("0+",x),,Map(attr,t,"m"))

Attempt This Online!

R has some weird string manipulation functions...

added 422 characters in body
Source Link
pajonk
  • 18.3k
  • 3
  • 25
  • 74

R, 64 bytes

\(x){regmatches(x,t)<-list(attr(el(t<-gregexpr("0+",x)),"m"))
x}

Attempt This Online!

Or as a one-liner:

\(x)`regmatches<-`(x,t<-gregexpr("0+",x),,list(attr(el(t),"m")))

Attempt This Online!

R has some weird string manipulation functions...

R, 64 bytes

\(x){regmatches(x,t)<-list(attr(el(t<-gregexpr("0+",x)),"m"))
x}

Attempt This Online!

R has some weird string manipulation functions...

R, 64 bytes

\(x){regmatches(x,t)<-list(attr(el(t<-gregexpr("0+",x)),"m"))
x}

Attempt This Online!

Or as a one-liner:

\(x)`regmatches<-`(x,t<-gregexpr("0+",x),,list(attr(el(t),"m")))

Attempt This Online!

R has some weird string manipulation functions...

Source Link
pajonk
  • 18.3k
  • 3
  • 25
  • 74
Loading